ci: post bazelbuild/bazel preview comments via dedicated GitHub App (#400)#471
Open
alan707 wants to merge 3 commits into
Open
ci: post bazelbuild/bazel preview comments via dedicated GitHub App (#400)#471alan707 wants to merge 3 commits into
alan707 wants to merge 3 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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.
Summary
Migrates the docs-preview comment-posting path on
bazelbuild/bazelPRs off the human-tiedBAZELBUILD_BAZEL_PATpersonal access token and onto a dedicated, least-privilege GitHub App ("Bazel Docs PR Commenter"). PATs inherit a person's full access and are discouraged for service accounts; an App is a scoped service identity. Closes #400.The preview build path already used a GitHub App (
GH_APP_ID) to pushpr-<N>branches to this repo. This change brings the upstream write path to the same model.What changed
commentjob mints a scoped installation token viaactions/create-github-app-token@v3(owner: bazelbuild,repositories: bazel) from new secretsBAZEL_PR_COMMENTER_APP_ID/BAZEL_PR_COMMENTER_PRIVATE_KEY, and posts/updates the preview comment with it instead of the PAT.continue-on-error: true. Graceful degradation: until a Bazel org owner installs the App onbazelbuild/bazel, previews still build and the comment step skips (logging the URL it would have posted). Same safe behavior as today's unset-PAT path.list-prsandcleanupdropped the PAT entirely; those are public reads, so the repo's owngithub.tokensuffices. (Verified in production: with the PAT already unset, these jobs have been readingbazelbuild/bazelviagithub.tokenon every cron run.)README.md: secrets table updated to the two App secrets, plus a short note on the App scope..gitignore: ignore*.pemso private keys can't be committed.App permission scope
The App needs exactly one permission on
bazelbuild/bazel: Issues: Read & write.A PR conversation comment is created via the issue-comments REST endpoint (
POST /repos/{o}/{r}/issues/{n}/comments), which GitHub's fine-grained permissions reference lists under Issues, not Pull requests (create is Issues-only; update/list accept either). The App token only ever calls the issue-comments endpoints. Every/pulls/*read in the workflow runs ongithub.token, so the App needs no Pull-requests access at all.Remaining step (human-gated)
A
bazelbuildorg owner must install the App onbazelbuild/bazel(Issues: Read & write, that repo only). Until then this PR is a no-op regression-wise: it changes the identity used for an already-skipping path. The App secrets are already set on this repo.Maintainer request template:
Test plan
ruby -ryaml).github.tokencross-repo reads ofbazelbuild/bazelconfirmed against the last several production cron runs (0 auth failures; cleanup read 58 PR states successfully).pr_numbertouchingdocs/; confirm the "Mint upstream comment token" step succeeds and a comment posts asbazel-docs-pr-commenter[bot].