workflows/eval: run when base branch changed (#372475)

authored by Wolfgang Walther and committed by GitHub 7b0400a7 66cc5bf2

+50 -10
-1
.github/workflows/check-format.yml
··· 5 5 paths: 6 6 - .github/workflows/check-format.yml 7 7 pull_request_target: 8 - types: [opened, synchronize, reopened, edited] 9 8 10 9 permissions: {} 11 10
+1 -1
.github/workflows/codeowners-v2.yml
··· 27 27 paths: 28 28 - .github/workflows/codeowners-v2.yml 29 29 pull_request_target: 30 - types: [opened, ready_for_review, synchronize, reopened, edited] 30 + types: [opened, ready_for_review, synchronize, reopened] 31 31 32 32 permissions: {} 33 33
+49
.github/workflows/edited.yml
··· 1 + # Some workflows depend on the base branch of the PR, but changing the base branch is not included in the default trigger events, which would be `opened`, `synchronize` or `reopened`. 2 + # Instead it causes an `edited` event. 3 + # Since `edited` is also triggered when PR title/body is changed, we use this wrapper workflow, to run the other workflows conditionally only. 4 + # There are already feature requests for adding a `base_changed` event: 5 + # - https://github.com/orgs/community/discussions/35058 6 + # - https://github.com/orgs/community/discussions/64119 7 + # 8 + # Instead of adding this to each workflow's pull_request_target event, we trigger this in a separate workflow. 9 + # This has the advantage, that we can actually skip running those jobs for simple edits like changing the title or description. 10 + # The actual trigger happens by closing and re-opening the pull request, which triggers the default pull_request_target events. 11 + # This is much simpler and reliable than other approaches. 12 + 13 + name: "Edited base branch" 14 + 15 + on: 16 + pull_request_target: 17 + types: [edited] 18 + 19 + permissions: {} 20 + 21 + jobs: 22 + base: 23 + name: Trigger jobs 24 + runs-on: ubuntu-24.04 25 + if: github.event.changes.base.ref.from && github.event.changes.base.ref.from != github.event.pull_request.base.ref 26 + steps: 27 + # Use a GitHub App to create the PR so that CI gets triggered 28 + # The App is scoped to Repository > Contents and Pull Requests: write for Nixpkgs 29 + # We only need Pull Requests: write here, but the app is also used for backports. 30 + - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 31 + id: app-token 32 + with: 33 + app-id: ${{ vars.NIXPKGS_CI_APP_ID }} 34 + private-key: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }} 35 + permission-pull-requests: write 36 + 37 + - env: 38 + GH_TOKEN: ${{ steps.app-token.outputs.token }} 39 + REPOSITORY: ${{ github.repository }} 40 + NUMBER: ${{ github.event.number }} 41 + run: | 42 + gh api \ 43 + --method PATCH \ 44 + /repos/"$REPOSITORY"/pulls/"$NUMBER" \ 45 + -f "state=closed" 46 + gh api \ 47 + --method PATCH \ 48 + /repos/"$REPOSITORY"/pulls/"$NUMBER" \ 49 + -f "state=open"
-1
.github/workflows/labels.yml
··· 7 7 8 8 on: 9 9 pull_request_target: 10 - types: [edited, opened, synchronize, reopened] 11 10 12 11 permissions: 13 12 contents: read
-5
.github/workflows/nixpkgs-vet.yml
··· 10 10 paths: 11 11 - .github/workflows/nixpkgs-vet.yml 12 12 pull_request_target: 13 - # This workflow depends on the base branch of the PR, but changing the base branch is not included in the default trigger events, which would be `opened`, `synchronize` or `reopened`. 14 - # Instead it causes an `edited` event, so we need to add it explicitly here. 15 - # While `edited` is also triggered when the PR title/body is changed, this PR action is fairly quick, and PRs don't get edited **that** often, so it shouldn't be a problem. 16 - # There is a feature request for adding a `base_changed` event: https://github.com/orgs/community/discussions/35058 17 - types: [opened, synchronize, reopened, edited] 18 13 19 14 permissions: {} 20 15
-2
.github/workflows/no-channel.yml
··· 5 5 paths: 6 6 - .github/workflows/no-channel.yml 7 7 pull_request_target: 8 - # Re-run should be triggered when the base branch is updated, instead of silently failing 9 - types: [opened, synchronize, reopened, edited] 10 8 11 9 permissions: {} 12 10