ci(release): grant actions:write so PR-close cleanup can cancel builds

gh run cancel needs the actions scope; with only contents: write the
cancellation 403s silently and the settle-poll burns its full window.
Also skip the cleanup job for fork PRs entirely: they never get a
draft and their token is read-only regardless of the permissions block.

Addresses Greptile P1 / Codex P2 follow-up on #1202.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5 committed 2026-07-18 16:28:39 +02:00
1 parent 4d793485a7
commit df812649b6
1 file changed
+7
+7
View File
@@ -4,12 +4,19 @@ on:
pull_request:
types: [closed]
# contents: write — delete the draft release; actions: write — cancel the
# closed PR's still-running build workflow before deleting.
permissions:
actions: write
contents: write
jobs:
delete-draft:
name: Delete PR draft release
# Fork PRs never get a draft (the release job skips them) and their
# GITHUB_TOKEN is read-only regardless of the permissions block, so
# there is nothing to cancel or delete.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
# A build for this PR may still be running and would recreate the