Skip to content

Commit

Permalink
check curl add details on error case
Browse files Browse the repository at this point in the history
  • Loading branch information
boly38 committed Nov 1, 2024
1 parent e8c520f commit d1ec246
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/publish_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ jobs:
- name: 2) push new release definition to another repo
run: |
# Disable -e temporarily to capture the curl exit status manually
set +e
response=$(curl -f -X POST \
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
Expand All @@ -100,9 +102,13 @@ jobs:
"download": "${{ env.REPO_WEB_URL }}/releases/download/${{ env.VERSION }}/package.readme.txt"
}
}')
# Capture the curl exit status
exit_status=$?
# Re-enable -e for the rest of the script
set -e
# Check for errors
if [ $? -ne 0 ]; then
echo "Error: curl command failed. Response: $response"
if [ $exit_status -ne 0 ]; then
echo "Error: curl command failed with status $exit_status and response:$response"
exit 1
fi
Expand Down

0 comments on commit d1ec246

Please sign in to comment.