Skip to content

ci: grant actions: write so the empty-matrix path can cancel the run - #74

Merged
opencode-collom[bot] merged 2 commits into
mainfrom
fix/ci-cancel-action-permissions
Nov 5, 2026
Merged

opencode-collom[bot] merged 2 commits into
mainfrom
fix/ci-cancel-action-permissions

Conversation

@opencode-collom

Copy link
Copy Markdown
Contributor

"Build Changed Container Images" is red on every main push that does not touch
an image directory:

Error: Resource not accessible by integration

The generate-changed-matrix job computes an empty matrix when no image
directory changed and then runs andymckay/cancel-action, which cancels the
workflow run through the Actions API
(POST /repos/{owner}/{repo}/actions/runs/{id}/cancel). The workflow only grants
contents: read, so that call is refused and the step fails, turning a
no-op push into a failed run.

Granting actions: write to the job lets the cancel succeed, which is what the
step is meant to do.

andymckay/cancel-action cancels the workflow run through the Actions API,
which needs actions: write. The workflow only granted contents: read, so
the cancel was refused with "Resource not accessible by integration" and
every main push that touched no image directory reported a failed run.
When no image directory changed the matrix is empty and the run was cancelled by
andymckay/cancel-action, which needs actions: write to cancel the run through the
Actions API. Without that permission the cancel was refused with "Resource not
accessible by integration" and every main push that touched no image directory
reported a failed run.

Skip the build job for an empty matrix instead. The run then completes green, the
job token keeps the least privilege it needs, and the matrix output still records
which images were considered.
@opencode-collom
opencode-collom Bot merged commit 6683f71 into main Nov 5, 2026
2 checks passed
@opencode-collom
opencode-collom Bot deleted the fix/ci-cancel-action-permissions branch November 5, 2026 12:43
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.

0 participants