|
9 | 9 |
|
10 | 10 |
|
11 | 11 | jobs: |
12 | | - write-message: |
| 12 | + trigger-tests: |
13 | 13 | if: github.event_name == 'pull_request' |
14 | | - name: Write Message |
| 14 | + name: Trigger Tests |
15 | 15 | runs-on: ubuntu-latest |
| 16 | + environment: "test-trigger-is" |
16 | 17 |
|
17 | 18 | steps: |
18 | 19 | - uses: actions/checkout@v3 |
19 | 20 |
|
20 | | - - name: Delete old comments |
21 | | - env: |
22 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
23 | | - run: | |
24 | | - # Delete previous comment if it exists |
25 | | - previous_comment_ids=$(gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \ |
26 | | - --jq '.[] | select(.body | startswith("<!-- INTEGRATION_TESTS -->")) | .id') |
27 | | - echo "Previous comment IDs: $previous_comment_ids" |
28 | | - # Iterate over each comment ID and delete the comment |
29 | | - if [ ! -z "$previous_comment_ids" ]; then |
30 | | - echo "$previous_comment_ids" | while read -r comment_id; do |
31 | | - echo "Deleting comment with ID: $comment_id" |
32 | | - gh api "repos/${{ github.repository }}/issues/comments/$comment_id" -X DELETE |
33 | | - done |
34 | | - fi |
35 | | - |
36 | | - - name: Write new comment |
| 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 |
37 | 31 | env: |
38 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + GH_TOKEN: ${{ steps.generate-token.outputs.token }} |
39 | 33 | run: | |
40 | | - gh pr comment ${{ github.event.pull_request.number }} --body \ |
41 | | - "<!-- INTEGRATION_TESTS --> |
42 | | - Run integration tests using the corresponding workflow: |
43 | | - |
44 | | - Inputs: |
45 | | - PR Number:${{github.event.pull_request.number}} |
46 | | - Commit SHA:${{ github.event.pull_request.head.sha }} |
47 | | - |
48 | | - This check will be approved automatically on success. |
49 | | - " |
| 34 | + gh workflow run sdk-go-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 }} |
50 | 38 |
|
| 39 | + |
51 | 40 | # The hash for the merge queue may not be the same as the hash for the PR. |
52 | 41 | # Auto approve the check for the merge queue to avoid running integration tests twice. |
53 | 42 | auto-approve: |
|
0 commit comments