Skip to content

Commit

Permalink
Post checking status (#11)
Browse files Browse the repository at this point in the history
* post checking status
* Improve output
  • Loading branch information
orensbruli authored Sep 29, 2023
1 parent cb3d95d commit e101c39
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,14 @@ runs:
esac
echo "⏁ Removing Runner from ZeroTier network"
curl -s -X DELETE -H "Authorization: token ${{ inputs.auth_token }}" "${{ inputs.api_url }}/network/${{ inputs.network_id }}/member/${member_id}"
curl -i -s -X DELETE -H "Authorization: token ${{ inputs.auth_token }}" "${{ inputs.api_url }}/network/${{ inputs.network_id }}/member/${member_id}" > /tmp/api_delete_output.txt
STATUS_CODE=$(cat /tmp/api_delete_output.txt | grep 'HTTP/' | awk '{print $2}')
if [[ $STATUS_CODE -ge 400 && $STATUS_CODE -le 599 ]]; then
echo "ERROR: Status code: $STATUS_CODE"
echo -e "Complete server response:\n$(cat /tmp/api_delete_output.txt)\n"
exit $STATUS_CODE
else
echo "Success! Status code: $STATUS_CODE"
exit 0
fi

0 comments on commit e101c39

Please sign in to comment.