|
| 1 | +name: Full CI (Comment Triggered) |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + trigger-check: |
| 9 | + if: | |
| 10 | + github.event.issue.pull_request && |
| 11 | + contains(github.event.comment.body, '/run-full-ci') && |
| 12 | + github.event.comment.author_association == 'OWNER' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + pr_head_sha: ${{ steps.pr.outputs.pr_head_sha }} |
| 16 | + pr_head_repo: ${{ steps.pr.outputs.pr_head_repo }} |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Get PR details |
| 20 | + id: pr |
| 21 | + uses: actions/github-script@v7 |
| 22 | + with: |
| 23 | + script: | |
| 24 | + const pr = await github.rest.pulls.get({ |
| 25 | + owner: context.repo.owner, |
| 26 | + repo: context.repo.repo, |
| 27 | + pull_number: context.issue.number |
| 28 | + }); |
| 29 | + core.setOutput('pr_head_sha', pr.data.head.sha); |
| 30 | + core.setOutput('pr_head_repo', pr.data.head.repo.full_name); |
| 31 | +
|
| 32 | + full-ci: |
| 33 | + needs: trigger-check |
| 34 | + uses: ./.github/workflows/_reusable-ci.yml |
| 35 | + with: |
| 36 | + checkout_ref: ${{ needs.trigger-check.outputs.pr_head_sha }} |
| 37 | + checkout_repository: ${{ needs.trigger-check.outputs.pr_head_repo }} |
| 38 | + check_type: 'full' |
| 39 | + environment: 'demo' |
| 40 | + secrets: inherit |
| 41 | + |
| 42 | + comment-result: |
| 43 | + needs: [trigger-check, full-ci] |
| 44 | + if: always() |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - name: Comment on PR |
| 48 | + uses: actions/github-script@v7 |
| 49 | + with: |
| 50 | + script: | |
| 51 | + const status = '${{ needs.full-ci.result }}' === 'success' ? '✅ PASSED' : '❌ FAILED'; |
| 52 | + await github.rest.issues.createComment({ |
| 53 | + owner: context.repo.owner, |
| 54 | + repo: context.repo.repo, |
| 55 | + issue_number: context.issue.number, |
| 56 | + body: `Full CI ${status} for commit ${{ needs.trigger-check.outputs.pr_head_sha }}\n\nTriggered by: @${{ github.event.comment.user.login }}` |
| 57 | + }); |
0 commit comments