Skip to content

test extended tests #10

test extended tests

test extended tests #10

name: Integration Tests
on:
- pull_request
- push
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- name: Get the branch name
id: get_branch
run: echo "branch=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})" >> $GITHUB_OUTPUT
- name: Get the originating repository
id: get_repo
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "repo=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_OUTPUT
else
echo "repo=${{ github.repository }}" >> $GITHUB_OUTPUT
fi
- name: Repository Dispatch
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