Skip to content

Commit

Permalink
feat: tag_fallback error grepping and flatten conditionals (#21)
Browse files Browse the repository at this point in the history
* Redirect stderr to stdout and flatten conditionals

* Use grep to suppress errors

* Fallback missing error handling
  • Loading branch information
DerekRoberts authored Jun 6, 2023
1 parent 107ead9 commit 5821d79
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,16 @@ runs:
echo " b) triggers not provided"
echo "triggered=true" >> $GITHUB_OUTPUT
exit 0
fi
else
# Build if tag_fallback is no good (requires a valid container)
docker buildx imagetools inspect ghcr.io/${{ inputs.repository }}/${{ inputs.package }}:${{ inputs.tag_fallback }} > /dev/null 2>&1
if [ $? -ne 0 ]
then
# Output triggered=true for next steps
echo "Build triggered. Fallback tag (tag_fallback) not usable."
echo "Manifest checked for: ghcr.io/${{ inputs.repository }}/${{ inputs.package }}:${{ inputs.tag_fallback }}"
echo "triggered=true" >> $GITHUB_OUTPUT
exit 0
fi
# Build if tag_fallback is no good (requires a valid container)
FALLBACK=ghcr.io/${{ inputs.repository }}/${{ inputs.package }}:${{ inputs.tag_fallback }}
if [ "$(docker buildx imagetools inspect ${FALLBACK} || true | grep -qi '^Name:')" = "" ]; then
# Output triggered=true for next steps
echo "Build triggered. Fallback tag (tag_fallback) not usable."
echo "Manifest checked for: ghcr.io/${FALLBACK}"
echo "triggered=true" >> $GITHUB_OUTPUT
exit 0
fi
# Build if changed files (git diff) match triggers
Expand Down

0 comments on commit 5821d79

Please sign in to comment.