Skip to content

Commit

Permalink
validate exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
lassemand committed Oct 21, 2024
1 parent 7c6a6e5 commit 5d538a9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ jobs:
run: |
echo '${{ steps.s3_objects.outputs.s3_objects }}' | jq -r '. | to_entries[] | .value' | while read -r ARN; do
echo "Checking for object at: $ARN"
if aws s3 ls "$ARN"; then
echo "error: item for $ARN already exists"
S3_OUTPUT=$(aws s3 ls "$ARN" --summarize 2>&1)
EXIT_CODE=$?
if [ $EXIT_CODE -eq 1 ]; then
echo "No object found for $ARN, proceeding."
elif [ $EXIT_CODE -eq 0 ]; then
echo "error: item for $ARN already exists."
exit 1
else
echo "No object found for $ARN"
echo "Unexpected exit code: $EXIT_CODE for $ARN."
echo "$S3_OUTPUT"
exit 1
fi
done
Expand Down

0 comments on commit 5d538a9

Please sign in to comment.