···11+# 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`.
22+# Instead it causes an `edited` event.
33+# Since `edited` is also triggered when PR title/body is changed, we use this wrapper workflow, to run the other workflows conditionally only.
44+# There are already feature requests for adding a `base_changed` event:
55+# - https://github.com/orgs/community/discussions/35058
66+# - https://github.com/orgs/community/discussions/64119
77+#
88+# Instead of adding this to each workflow's pull_request_target event, we trigger this in a separate workflow.
99+# This has the advantage, that we can actually skip running those jobs for simple edits like changing the title or description.
1010+# The actual trigger happens by closing and re-opening the pull request, which triggers the default pull_request_target events.
1111+# This is much simpler and reliable than other approaches.
1212+1313+name: "Edited base branch"
1414+1515+on:
1616+ pull_request_target:
1717+ types: [edited]
1818+1919+permissions: {}
2020+2121+jobs:
2222+ base:
2323+ name: Trigger jobs
2424+ runs-on: ubuntu-24.04
2525+ if: github.event.changes.base.ref.from && github.event.changes.base.ref.from != github.event.pull_request.base.ref
2626+ steps:
2727+ # Use a GitHub App to create the PR so that CI gets triggered
2828+ # The App is scoped to Repository > Contents and Pull Requests: write for Nixpkgs
2929+ # We only need Pull Requests: write here, but the app is also used for backports.
3030+ - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
3131+ id: app-token
3232+ with:
3333+ app-id: ${{ vars.NIXPKGS_CI_APP_ID }}
3434+ private-key: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }}
3535+ permission-pull-requests: write
3636+3737+ - env:
3838+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
3939+ REPOSITORY: ${{ github.repository }}
4040+ NUMBER: ${{ github.event.number }}
4141+ run: |
4242+ gh api \
4343+ --method PATCH \
4444+ /repos/"$REPOSITORY"/pulls/"$NUMBER" \
4545+ -f "state=closed"
4646+ gh api \
4747+ --method PATCH \
4848+ /repos/"$REPOSITORY"/pulls/"$NUMBER" \
4949+ -f "state=open"
···1010 paths:
1111 - .github/workflows/nixpkgs-vet.yml
1212 pull_request_target:
1313- # 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`.
1414- # Instead it causes an `edited` event, so we need to add it explicitly here.
1515- # 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.
1616- # There is a feature request for adding a `base_changed` event: https://github.com/orgs/community/discussions/35058
1717- types: [opened, synchronize, reopened, edited]
18131914permissions: {}
2015
-2
.github/workflows/no-channel.yml
···55 paths:
66 - .github/workflows/no-channel.yml
77 pull_request_target:
88- # Re-run should be triggered when the base branch is updated, instead of silently failing
99- types: [opened, synchronize, reopened, edited]
108119permissions: {}
1210