1+ name : Integration Tests
2+
3+ on :
4+
5+ pull_request :
6+ types : [opened, synchronize]
7+
8+ merge_group :
9+
10+
11+ jobs :
12+ trigger-tests :
13+ if : github.event_name == 'pull_request'
14+ name : Trigger Tests
15+ runs-on : ubuntu-latest
16+ environment : " test-trigger-is"
17+
18+ steps :
19+ - uses : actions/checkout@v3
20+
21+ - name : Generate GitHub App Token
22+ id : generate-token
23+ uses : actions/create-github-app-token@v1
24+ with :
25+ app-id : ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}
26+ private-key : ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }}
27+ owner : ${{ secrets.ORG_NAME }}
28+ repositories : ${{secrets.REPO_NAME}}
29+
30+ - name : Trigger Workflow in Another Repo
31+ env :
32+ GH_TOKEN : ${{ steps.generate-token.outputs.token }}
33+ run : |
34+ gh workflow run sdk-py-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{secrets.REPO_NAME}} \
35+ --ref main \
36+ -f pull_request_number=${{ github.event.pull_request.number }} \
37+ -f commit_sha=${{ github.event.pull_request.head.sha }}
38+
39+
40+ # The hash for the merge queue may not be the same as the hash for the PR.
41+ # Auto approve the check for the merge queue for two reasons:
42+ # * Queue times out due to duration of tests.
43+ # * Avoid running integration tests twice.
44+ auto-approve :
45+ if : github.event_name == 'merge_group'
46+ runs-on : ubuntu-latest
47+ steps :
48+ - name : Mark Check
49+ env :
50+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51+ shell : bash
52+ run : |
53+ gh api -X POST -H "Accept: application/vnd.github+json" \
54+ -H "X-GitHub-Api-Version: 2022-11-28" \
55+ /repos/${{ github.repository }}/statuses/${{ github.sha }} \
56+ -f 'state=success' \
57+ -f 'context=Integration Tests Check'
0 commit comments