Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.short-sha.outputs.sha }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v2
# with:
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: false
Comment on lines +51 to +56
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Attestation step will fail on pull_request events – add a guard

docker/build-push-action does not populate steps.push.outputs.digest when push: false (which is the case for pull-requests).
Because the attestation step runs unconditionally, it receives an empty digest and the action errors out.

       - name: Generate artifact attestation
+        # Only run when an image has actually been pushed
+        if: ${{ github.event_name != 'pull_request' }}
         uses: actions/attest-build-provenance@v2

This keeps the workflow green for PRs while still producing provenance for main/tag pushes.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: false
- name: Generate artifact attestation
# Only run when an image has actually been pushed
if: ${{ github.event_name != 'pull_request' }}
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: false
🤖 Prompt for AI Agents
In .github/workflows/ghcr.yml around lines 51 to 56, the attestation step runs
unconditionally and fails on pull_request events because
steps.push.outputs.digest is empty when push is false. Fix this by adding a
conditional guard to the attestation step so it only runs when the digest output
is available, typically by checking if the event is not a pull_request or if the
digest exists, preventing errors and keeping the workflow green for PRs.

Loading