From d1ec246cb669a4103711e8e0ccca59af0bdbcd6b Mon Sep 17 00:00:00 2001 From: Brice Vandeputte Date: Fri, 1 Nov 2024 20:09:54 +0100 Subject: [PATCH] check curl add details on error case --- .github/workflows/publish_sample.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_sample.yml b/.github/workflows/publish_sample.yml index 69f3658..864569e 100644 --- a/.github/workflows/publish_sample.yml +++ b/.github/workflows/publish_sample.yml @@ -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" \ @@ -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