Skip to content

Commit

Permalink
Trying to make steps fail when something goes wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
datapythonista committed Jan 27, 2024
1 parent 06d8c5e commit af2adb4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ runs:
env:
PREVIEWER_URL: "${{ inputs.previewer-server }}/preview/${{ github.repository }}/${{ github.event.issue.number }}"
ARTIFACT_JOB: ${{ inputs.artifact-job }}
run: echo "previewer-response=$(curl -X POST -f --data-urlencode \"job=${ARTIFACT_JOB}\" ${PREVIEWER_URL})" >> "$GITHUB_OUTPUT"
run: |
PREVIEWER_RESPONSE=$(curl -X POST -f --data-urlencode \"job=${ARTIFACT_JOB}\" ${PREVIEWER_URL})
EXIT_CODE=$?
echo "previewer-response=${PREVIEWER_RESPONSE}" | tee -a "$GITHUB_OUTPUT"
exit ${EXIT_CODE}
- name: "Add GitHub Comment"
shell: bash
env:
ADD_COMMENT_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
GITHUB_TOKEN: ${{ github.token }}
PREVIEWER_RESPONSE: ${{ steps.call-previewer.outputs.previewer-response }}
run: |
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -d '{"body": "${{ env.PREVIEWER_RESPONSE }}"}' ${ADD_COMMENT_URL}
curl -f -H "Authorization: Bearer ${GITHUB_TOKEN}" -d '{"body": "${{ env.PREVIEWER_RESPONSE }}"}' ${ADD_COMMENT_URL}

0 comments on commit af2adb4

Please sign in to comment.