-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Internal] Automatically trigger integration tests on PR
- Loading branch information
1 parent
d3b85cb
commit 15581e2
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
|
||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
merge_group: | ||
|
||
|
||
jobs: | ||
trigger-tests: | ||
if: github.event_name == 'pull_request' | ||
name: Trigger Tests | ||
runs-on: ubuntu-latest | ||
environment: "test-trigger-is" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Generate GitHub App Token | ||
id: generate-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }} | ||
private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }} | ||
owner: ${{ secrets.ORG_NAME }} | ||
repositories: ${{secrets.REPO_NAME}} | ||
|
||
- name: Trigger Workflow in Another Repo | ||
env: | ||
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | ||
run: | | ||
gh workflow run sdk-py-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{secrets.REPO_NAME}} \ | ||
--ref main \ | ||
-f pull_request_number=${{ github.event.pull_request.number }} \ | ||
-f commit_sha=${{ github.event.pull_request.head.sha }} | ||
# The hash for the merge queue may not be the same as the hash for the PR. | ||
# Auto approve the check for the merge queue to avoid running integration tests twice. | ||
auto-approve: | ||
if: github.event_name == 'merge_group' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Mark Check | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
shell: bash | ||
run: | | ||
gh api -X POST -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | ||
-f 'state=success' \ | ||
-f 'context=Integration Tests Check' |