Skip to content

ci(release): open the changelog PR as the release App - #402

Merged
kylecarbs merged 1 commit into
mainfrom
ci/release-pr-app-token
Nov 20, 2026
Merged

kylecarbs merged 1 commit into
mainfrom
ci/release-pr-app-token

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

The org no longer lets GITHUB_TOKEN open pull requests, so the release's changelog PR fails at the end of the run with GitHub Actions is not permitted to create or approve pull requests.

The build job now uploads the changed file(s) as an artifact and drops its PR permissions. A new last job, changelog, runs in the main-only release-pr environment. It downloads the files, checks whether anything changed, and only then mints a token from coder-jetbrains-toolbox-release through Cloud KMS, scoped to this repo with contents and pull-request write. It pushes the branch and opens the PR with that token. Only this job requests id-token, so the Gradle build can't sign as the App, which can create release tags. App-opened PRs also trigger CI.

Merge after: coder/github-org-terraform#202 (the release-pr env and the App's pull_requests: write) and coder/gcp#471 (the key trusts this workflow in release-pr) are applied, the App's new permission is accepted, and release-pr has the three App secrets.

actionlint is clean, and zizmor shows no new findings.

🤖 Generated with Claude Code

GITHUB_TOKEN can't open pull requests in the coder org, so the release's
changelog pull request failed. The build job now uploads the changed files,
and a new last job (changelog) in the main-only release-pr environment opens
the PR as coder-jetbrains-toolbox-release (Cloud KMS). Only that job gets
id-token, so the Gradle build can't sign as the App.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kylecarbs
kylecarbs merged commit c6ae710 into main Nov 20, 2026
8 checks passed
@kylecarbs
kylecarbs deleted the ci/release-pr-app-token branch November 20, 2026 20:47
exit 0
fi
gh auth setup-git
branch="changelog-update-$VERSION"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make this part idempotent. The branch name is deterministic and the push is not forced, with no check for an existing branch or open PR. I think there are some scenarios that run into issues:

  • the first run pushes the branch then fails at gh pr create; a user re-runs the failed job — the push is rejected ("fetch first") and the job stays red until a user deletes the branch.
  • same for re-dispatching the same version: approve sees the tag exists, publish re-runs, and changelog dies at the push even though the PR is already open. A "skip if a PR for this head branch already exists" guard (one gh pr list call) would make re-runs clean.

@fioan89 fioan89 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants