Skip to content

Commit 719363e

Browse files
authored
Merge pull request #10 from navnorth/testing
NN-446 - NN Web Theme CI/CD Pipeline
2 parents 4450706 + 86aedfc commit 719363e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)