Skip to content

fix(workflow): use app token for gh variable set — GITHUB_TOKEN lacks permission#7771

Merged
BYK merged 1 commit into
mainfrom
fix/ci-poller-variable-auth
Apr 10, 2026
Merged

fix(workflow): use app token for gh variable set — GITHUB_TOKEN lacks permission#7771
BYK merged 1 commit into
mainfrom
fix/ci-poller-variable-auth

Conversation

@BYK

@BYK BYK commented Apr 10, 2026

Copy link
Copy Markdown
Member

Summary

Two fixes for the CI status poller:

1. Use app token for gh variable set

GITHUB_TOKEN cannot write repo variables — returns 403 "Resource not accessible by integration" even with actions: write.

Failing run: https://github.com/getsentry/publish/actions/runs/24263308562/job/70852292016

2. Resolve release branch HEAD instead of stale issue SHA

When a bot pushes a new commit to the release branch after issue creation, the "View check runs" SHA in the issue body is stale. The poller checks CI on the old commit and never sees the new CI results.

Failing run: https://github.com/getsentry/publish/actions/runs/24264032659/job/70854676310

Fix: Use the Check Suites API to discover the branch name from the original SHA (check_suites[0].head_branch), then resolve the branch HEAD via git/ref/heads/{branch}. If it moved, update the issue body so the link stays accurate for humans and future poller runs.

Fallback: if check suites return nothing, use the issue body SHA as before.

Changes

  • ci-pending.yml: Use app token for gh variable set
  • ci-poller.yml: Use app token for gh variable set; resolve branch HEAD dynamically; update stale issue links
  • ci-poller.yml, ci-pending.yml: Remove unnecessary actions: write permission

… permission

GITHUB_TOKEN cannot write repo variables via the Actions Variables API —
returns 403 "Resource not accessible by integration" even with
actions:write permission. Use the sentry-internal-app token instead,
which has the necessary admin permissions.

Also removes the now-unnecessary actions:write from workflow permissions.
@BYK BYK marked this pull request as ready for review April 10, 2026 21:11
@BYK BYK requested a review from a team as a code owner April 10, 2026 21:11
@BYK BYK merged commit 6155b7a into main Apr 10, 2026
10 checks passed
@BYK BYK deleted the fix/ci-poller-variable-auth branch April 10, 2026 21:17
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.

1 participant