Repository navigation
Push the API references with GITHUB_TOKEN, falling back to a pull request - #1453
Merged
Merged
Conversation
…nstead of the REPO_TOKEN secret that GitHub now rejects, falling back to a pull request when master refuses the push
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The workflow handles direct pushes, protected branches, existing pull requests, and disabled automatic PR creation coherently.
Review effort: Balanced
Findings: None
What changed in this PR
Updates API-reference automation to use GITHUB_TOKEN and gracefully handle protected branches.
Changes:
- Grants required repository and pull-request permissions.
- Pushes directly when allowed; otherwise updates a dedicated branch and opens a pull request.
- Emits a manual pull-request link when automatic creation is disabled.
| File | Description |
|---|---|
.github/workflows/update_api_references.yml |
Adds token permissions and protected-branch fallback logic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
Looks good, thanks for working on this ❤️ |
Contributor
Author
|
Thanks! It hasn't run on master yet, since it only starts on changes under |
This was referenced Oct 19, 2026
Merged
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.
Since #1443 the "Update API references" job fails at
actions/checkout: it checks out withsecrets.REPO_TOKEN, GitHub rejects that token, and git reportscould not read Username for 'https://github.com'.The job now uses the default
GITHUB_TOKEN, withcontents: write, and pushes the regenerated docs to master, as before. master may refuse that push: all but one of its last 400 commits came through a pull request. When it does, the job falls back to a pull request:update-api-referencesbranch, which updates the pull request from that branch if one is already open;actions/checkoutfails:could not read Usernameupdate-api-referenceswith a pull request into masterChecked on GitHub runners, with the default workflow permissions set to read only:
REPO_TOKEN, the checkout fails with the same error;github-actions[bot]pushes the docs straight to it;GH006: Protected branch update failed) and the job pushesupdate-api-references; with "Allow GitHub Actions to create and approve pull requests" off it leaves the notice and the link, with it on it opens the pull request;REPO_TOKENis no longer used by any workflow after this change.