fix(workflow): add GH_TOKEN to gh CLI steps and split variable/label auth#7768
Merged
Conversation
gh CLI in GitHub Actions requires GH_TOKEN to be set explicitly — it does not auto-detect GITHUB_TOKEN despite the docs suggesting it. Split steps that do both label changes and variable updates: - Label changes: use the app token (so events trigger publish.yml) - Variable set: use GITHUB_TOKEN with actions:write (app token may lack actions_variables permission)
BYK
added a commit
that referenced
this pull request
Apr 10, 2026
… permission (#7771) ## Summary Fix `ci-poller.yml` failing with `HTTP 403: Resource not accessible by integration` when calling `gh variable set CI_POLLER_HAS_PENDING`. Failing run: https://github.com/getsentry/publish/actions/runs/24263308562/job/70852292016 ## Root Cause `GITHUB_TOKEN` cannot write repo variables through the Actions Variables API, even with `actions: write` in the workflow permissions block. The sentry-internal-app token has admin access and can write variables. PR #7768 incorrectly assumed the opposite (that the app token lacked permission and `GITHUB_TOKEN` had it). ## Changes - `ci-poller.yml`: "Disable poller" step uses app token instead of `GITHUB_TOKEN` - `ci-pending.yml`: "Enable cron poller" step uses app token instead of `GITHUB_TOKEN` - Remove unnecessary `actions: write` from both workflow permission blocks
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
Fix CI poller and waiting-for-ci workflows failing because:
ghCLI requiresGH_TOKENto be set explicitly in GitHub ActionsGITHUB_TOKENcannot write repo variables — returns 403 "Resource not accessible by integration"Failing runs:
Changes
publish.yml: AddGH_TOKEN: ${{ github.token }}towaiting-for-cicomment stepci-pending.yml: Split into two steps — label change and variable set both use app tokenci-poller.yml: Same split — variable disable step uses app token instead ofGITHUB_TOKENactions: writepermission (not needed when using app token)