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 terraform-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+
41+ # Statuses and checks apply to specific commits (by hash).
42+ # Enforcement of required checks is done both at the PR level and the merge queue level.
43+ # In case of multiple commits in a single PR, the hash of the squashed commit
44+ # will not match the one for the latest (approved) commit in the PR.
45+ # We auto approve the check for the merge queue for two reasons:
46+ # * Queue times out due to duration of tests.
47+ # * Avoid running integration tests twice, since it was already run at the tip of the branch before squashing.
48+ auto-approve :
49+ if : github.event_name == 'merge_group'
50+ runs-on : ubuntu-latest
51+ steps :
52+ - name : Mark Check
53+ env :
54+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55+ shell : bash
56+ run : |
57+ gh api -X POST -H "Accept: application/vnd.github+json" \
58+ -H "X-GitHub-Api-Version: 2022-11-28" \
59+ /repos/${{ github.repository }}/statuses/${{ github.sha }} \
60+ -f 'state=success' \
61+ -f 'context=Integration Tests Check'
0 commit comments