Skip to content

Commit

Permalink
ci: add extended repository dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon committed Apr 18, 2024
1 parent 659bb61 commit 6274c18
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,25 @@ jobs:
fi
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: "${{ secrets.PAT_INTEGRATION_TESTS}}"
repository: expressjs/examples
event-type: integration-tests
client-payload: '{"branch": "${{ steps.get_branch.outputs.branch }}", "repo": "${{ steps.get_repo.outputs.repo }}"}'
env:
TOKEN: ${{ secrets.PAT_INTEGRATION_TESTS }}
run: |
response=$(curl -X POST https://api.github.com/repos/expressjs/examples/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-H "Authorization: token $TOKEN" \
--data '{"event_type": "integration-tests", "client_payload": {"branch": "${{ steps.get_branch.outputs.branch }}", "repo": "${{ steps.get_repo.outputs.repo }}"}}')
workflow_url=$(echo "$response" | jq -r .url)
status=""
while [[ "$status" != "completed" ]]; do
sleep 10
response=$(curl -H "Authorization: token $TOKEN" $workflow_url)
status=$(echo "$response" | jq -r .status)
done
conclusion=$(echo "$response" | jq -r .conclusion)
if [[ "$conclusion" != "success" ]]; then
echo "Workflow failed"
exit 1
fi

0 comments on commit 6274c18

Please sign in to comment.