File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,22 @@ jobs:
1616 run : |
1717 BRANCH_NAME=${GITHUB_REF##*/}
1818 echo "Triggering deployment for branch: $BRANCH_NAME"
19+
20+ # Make the API request and capture the response code
1921 RESPONSE=$(curl -s -o response.json -w "%{http_code}" -X POST \
20- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
22+ -H "Authorization: token ${{ secrets.DEPLOY_PAT }}" \
2123 -H "Accept: application/vnd.github.everest-preview+json" \
2224 https://api.github.com/repos/navnorth/wp-nn-dot-com/dispatches \
2325 -d "{\"event_type\": \"trigger-sync-theme\", \"client_payload\": {\"branch\": \"$BRANCH_NAME\"}}")
2426
2527 echo "API Response Code: $RESPONSE"
2628 cat response.json
29+
30+ # Exit with non-zero status if the response is 404
31+ if [ "$RESPONSE" -eq 404 ]; then
32+ echo "Error: Repository not found (404)"
33+ exit 1
34+ elif [ "$RESPONSE" -eq 422 ]; then
35+ echo "Error: Validation failed, or the endpoint has been spammed. (404)"
36+ exit 1
37+ fi
You can’t perform that action at this time.
0 commit comments