Repository navigation
ci: grant actions: write so the empty-matrix path can cancel the run - #74
Merged
Merged
Conversation
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.
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.
"Build Changed Container Images" is red on every
mainpush that does not touchan image directory:
The
generate-changed-matrixjob computes an empty matrix when no imagedirectory changed and then runs
andymckay/cancel-action, which cancels theworkflow run through the Actions API
(
POST /repos/{owner}/{repo}/actions/runs/{id}/cancel). The workflow only grantscontents: read, so that call is refused and the step fails, turning ano-op push into a failed run.
Granting
actions: writeto the job lets the cancel succeed, which is what thestep is meant to do.