testing theme #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger Target Repository Workflow | |
on: | |
push: | |
branches: | |
- main | |
- stage | |
- testing | |
jobs: | |
notify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger Target Repository | |
run: | | |
BRANCH_NAME=${GITHUB_REF##*/} | |
echo "Triggering deployment for branch: $BRANCH_NAME" | |
# Make the API request and capture the response code | |
RESPONSE=$(curl -s -o response.json -w "%{http_code}" -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
https://api.github.com/repos/navnorth/wp-nn-dot-com/dispatches \ | |
-d "{\"event_type\": \"trigger-sync-theme\", \"client_payload\": {\"branch\": \"$BRANCH_NAME\"}}") | |
echo "API Response Code: $RESPONSE" | |
cat response.json | |
# Exit with non-zero status if the response is 404 | |
if [ "$RESPONSE" -eq 404 ]; then | |
echo "Error: Repository not found (404)" | |
exit 1 | |
fi |