Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: brackets and allow sha repeats #56

Merged
merged 15 commits into from
Jul 11, 2024
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 }}"