Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/build-changed-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ permissions:
jobs:
generate-changed-matrix:
runs-on: ubuntu-latest
permissions:
contents: read
# andymckay/cancel-action cancels the workflow run through the Actions
# API (POST /repos/{owner}/{repo}/actions/runs/{id}/cancel), which
# needs actions: write. Without it the empty-matrix path fails with
# "Resource not accessible by integration" and the run goes red.
actions: write
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
empty: ${{ steps.matrix.outputs.empty }}

steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -45,12 +53,14 @@ jobs:
fi
echo "matrix=$(cat images.list)" >> $GITHUB_OUTPUT

- name: Cancelling for empty matrix
if: ${{ steps.matrix.outputs.empty == 'true' }}
uses: andymckay/cancel-action@a955d435292c0d409d104b57d8e78435a93a6ef1
# No image directory changed, so there is nothing to build. The build job
# below is skipped for an empty matrix, which keeps the run green instead
# of cancelling it and avoids the actions: write permission that
# andymckay/cancel-action needs in order to cancel the run.

build-images:
needs: generate-changed-matrix
if: ${{ needs.generate-changed-matrix.outputs.empty != 'true' }}
# A reusable workflow can only narrow the permissions granted here, so the
# GHCR push needs packages: write on the caller as well.
permissions:
Expand Down
Loading