Skip to content

Commit

Permalink
fix: brackets and allow sha repeats (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts authored Jul 11, 2024
1 parent 48ff07f commit ef2389c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ runs:
id: digest_old
shell: bash
run: |
DIGEST=$(docker manifest inspect ${{ steps.vars.outputs.tags }} || echo | jq '.manifests[0].digest')
DIGEST=$((docker manifest inspect ${{ steps.vars.outputs.tags }} || echo )| jq -r '.manifests[0].digest')
echo "digest=${DIGEST}" >> $GITHUB_OUTPUT
# If a build is required, then checkout, login, build and push!
Expand Down Expand Up @@ -180,13 +180,12 @@ runs:
id: digest_new
shell: bash
run: |
DIGEST=$(docker manifest inspect ${{ steps.vars.outputs.tags }} | jq '.manifests[0].digest')
DIGEST=$(docker manifest inspect ${{ steps.vars.outputs.tags }} | jq -r '.manifests[0].digest')
echo "digest=${DIGEST}" >> $GITHUB_OUTPUT
# Bug - fail if old and new digests match (e.g. no new image was built)
- name: SHA Double-check
if: steps.build.outputs.triggered == 'true' && steps.digest_new.outputs.digest == steps.digest_old.outputs.digest
shell: bash
- shell: bash
run: |
echo "SHA collision! New: ${{ steps.digest_new.outputs.digest }}, Old: ${{ steps.digest_old.outputs.digest }}"
exit 1
# Summary
echo "digest_new: ${{ steps.digest_new.outputs.digest }}"
echo "digest_old: ${{ steps.digest_old.outputs.digest }}"
echo "triggered: ${{ steps.diff.outputs.triggered }}"

0 comments on commit ef2389c

Please sign in to comment.