Adding logic to skip status without proper data

This commit is contained in:
Lucas Gravley 2020-07-21 10:13:15 -05:00
parent 4d079ba298
commit 6022bd2ee6

View file

@ -826,32 +826,37 @@ CallStatusAPI() {
MESSAGE="$FAIL_MSG"
fi
##############################################
# Call the status API to create status check #
##############################################
SEND_STATUS_CMD=$(curl -f -s -X POST \
--url "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \
-H 'accept: application/vnd.github.v3+json' \
-H "authorization: Bearer $GITHUB_TOKEN" \
-H 'content-type: application/json' \
-d "{ \"state\": \"$STATUS\",
\"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\",
\"description\": \"$MESSAGE\", \"context\": \"--> Linted: $LANGUAGE\"
}" 2>&1)
##########################################################
# Check to see if were enabled for multi Status mesaages #
##########################################################
if [ $MULTI_STATUS == "true" ]; then
##############################################
# Call the status API to create status check #
##############################################
SEND_STATUS_CMD=$(curl -f -s -X POST \
--url "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \
-H 'accept: application/vnd.github.v3+json' \
-H "authorization: Bearer $GITHUB_TOKEN" \
-H 'content-type: application/json' \
-d "{ \"state\": \"$STATUS\",
\"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\",
\"description\": \"$MESSAGE\", \"context\": \"--> Linted: $LANGUAGE\"
}" 2>&1)
#######################
# Load the error code #
#######################
ERROR_CODE=$?
#######################
# Load the error code #
#######################
ERROR_CODE=$?
##############################
# Check the shell for errors #
##############################
if [ "$ERROR_CODE" -ne 0 ]; then
# ERROR
echo "ERROR! Failed to call GitHub Status API!"
echo "ERROR:[$SEND_STATUS_CMD]"
# Not going to fail the script on this yet...
##############################
# Check the shell for errors #
##############################
if [ "$ERROR_CODE" -ne 0 ]; then
# ERROR
echo "ERROR! Failed to call GitHub Status API!"
echo "ERROR:[$SEND_STATUS_CMD]"
# Not going to fail the script on this yet...
fi
fi
}
################################################################################