Repository navigation
fix(ci): use release app token for nixpkgs bump PR creation - #890
Merged
Merged
Conversation
The commit app installation only carries contents:write, so the final 'Open PR if none exists' step failed every run with 'GraphQL: Resource not accessible by integration (createPullRequest)'. Mint a second token from the release app - the same two-app split sync-main-to-dev.yml and the release workflows already use for PR operations - and use it for the gh pr list/create step. Commit and branch operations stay on the least-privilege commit app token. Refs: #817
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Every run of
update-nixpkgs-unstable.ymlso far failed at the final "Open PR if none exists" step with:Root cause: the whole workflow ran on a single token minted from the commit app (
COMMIT_APP_*). That app installation carriescontents: writeonly — which is why the earlier steps succeeded (branchchore/update-nixpkgs-unstablewas created and the signed lock-bump commit landed) whilecreatePullRequestwas refused. This repo deliberately splits app duties (see the auth comment insync-main-to-dev.yml):COMMIT_APP_*for least-privilege git/ref/commit operations,RELEASE_APP_*for PR/label operations that require pull-request scopes. Every PR-creating workflow in the repo (sync-main-to-dev.yml,prepare-release.yml,promote-release.yml,release.yml) already uses a release-app token for PR operations — e.g. PR #873 was opened this way.renovate-changelog-commit.yml(cited in this workflow's comments as the model) only commits with the commit app; it never creates PRs, so copying it left the PR step under-privileged.Note on
actions/create-github-app-token@v3semantics: with nopermission-*inputs the minted token inherits all of the app installation's permissions, so no token-scoping inputs were missing — the commit app installation simply does not havepull-requests: write, by design.Type of Change
fix-- Bug fixci-- CI/CD pipeline changesModifiers
!)Changes Made
.github/workflows/update-nixpkgs-unstable.yml: add aGenerate Release App Tokenstep (RELEASE_APP_CLIENT_ID/RELEASE_APP_PRIVATE_KEY, guarded by the samechanged == 'true'condition) and switch theOpen PR if none existsstep to that token. Branch creation and the signed commit stay on the commit-app token.GITHUB_TOKENfor PR creation: PRs it opens do not trigger CI, and full CI on the bump PR is this workflow's merge gate. App-token-created PRs do trigger CI (proven by the sync-main-to-dev PRs).No org/app settings change required — the release app already holds
pull-requests: write(it opens the sync and release PRs today), and its secrets are already available to workflows in this repo.Changelog Entry
No changelog needed: the
## Unreleasedsection already carries the #817 entry ("Scheduled nixpkgs-unstable lock bump") describing this workflow, which has never shipped in a release; this PR is a CI-internal repair of that same unreleased item.Testing
Manual Testing Details
prek run --all-files: full hook suite green (yamllint, check-action-pins, typos, etc.).workflow_dispatchrun of Update nixpkgs-unstable after this merges to dev. Expected: the run reuses/reset the existingchore/update-nixpkgs-unstablebranch, commits the lock bump, and now successfully opens the PR to dev.Checklist
CHANGELOG.md(not needed — see Changelog Entry)Additional Notes
Closes #817
This issue belongs to epic #814 (home-environment modules).
Refs: #814