fix(ci): grant explicit GITHUB_TOKEN permissions to workflows - #466
Merged
Jan-Kazlouski-elastic merged 4 commits intoAug 4, 2026
Merged
Conversation
The repository default for GITHUB_TOKEN is now read-only, and neither workflow declared a permissions block, so backport started failing with push denied to github-actions[bot] and "Resource not accessible by integration" when commenting on the source PR. Declare the scopes each workflow actually needs, which overrides the read-only default without re-granting write to everything. Part of #465 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
erikcurrin-elastic
approved these changes
Aug 4, 2026
Jan-Kazlouski-elastic
enabled auto-merge (squash)
August 4, 2026 12:57
Jan-Kazlouski-elastic
deleted the
jan-kazlouski/fix-workflow-github-token-permissions
branch
August 4, 2026 13:04
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.
Closes #465
Same failure mode as elastic/connectors#4289.
The repository's default
GITHUB_TOKENpermission is now read-only:Neither workflow in
.github/workflows/declared apermissions:block, so they inherit that default. After merging #462, backport failed with:Permission to elastic/crawler.git denied to github-actions[bot]ongit pushof the backport branch (contents: writemissing)Resource not accessible by integrationwhen posting the failure comment on the source PR (pull-requests: writemissing)This declares the scopes each workflow actually needs (least privilege), overriding the read-only default without flipping the repository setting back to read/write for everything.
add-labels-main.ymlcontents: read,pull-requests: writeproduct_version; action labels the PRbackport.ymlcontents: write,pull-requests: writebackport.yml'sapprover_token(REPO_SCOPED_TOKEN) is unaffected by theGITHUB_TOKENdefault.Note on verifying this PR
pull_request_targetalways runs the workflow from the base branch, so backport/add-labels will still usemain's copy (without permissions) while this PR is open. The fix takes effect only after merge. After merge, re-trigger backport for any PRs that failed (e.g. #462) by re-adding theauto-backportlabel, or run the manual command from the failure comment.Checklists
Pre-Review Checklist
Deliberately not labelled
auto-backport: both workflows are gated onbranches: main, so copies on maintenance branches never run.Changes Requiring Extra Attention
pull_request_target. Grants are safe: neither checks out or executes PR head code.add-labels-main.ymlchecks out the base ref and only readsproduct_version.backport.ymlchecks out a pinned external actions repo and only runs after merge intomain.Release Note
No user-facing change; CI configuration only.
Made with Cursor