diff --git a/action.yml b/action.yml index 5893ac6..491cc9d 100644 --- a/action.yml +++ b/action.yml @@ -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