|
11 | 11 | NODE_VERSION: 22 |
12 | 12 |
|
13 | 13 | permissions: |
14 | | - contents: read # To allow the action to read repository contents |
15 | | - pull-requests: write # To allow the action to create/update pull request comments |
| 14 | + contents: read |
| 15 | + pull-requests: write |
16 | 16 | checks: write |
| 17 | + actions: read |
17 | 18 |
|
18 | 19 | jobs: |
19 | 20 | context: |
|
46 | 47 | run_testdriver: |
47 | 48 | name: Run TestDriver.ai |
48 | 49 | runs-on: windows-latest |
| 50 | + if: github.event.workflow_run.conclusion == 'success' |
49 | 51 | steps: |
| 52 | + - name: Create Check Run |
| 53 | + id: create-check |
| 54 | + uses: actions/github-script@v7 |
| 55 | + with: |
| 56 | + script: | |
| 57 | + const check = await github.rest.checks.create({ |
| 58 | + owner: context.repo.owner, |
| 59 | + repo: context.repo.repo, |
| 60 | + name: 'TestDriver.ai Run', |
| 61 | + head_sha: '${{ github.event.workflow_run.head_sha }}', |
| 62 | + status: 'in_progress' |
| 63 | + }); |
| 64 | + return check.data.id; |
| 65 | +
|
50 | 66 | - uses: testdriverai/action@main |
51 | 67 | id: testdriver |
52 | 68 | env: |
@@ -138,3 +154,23 @@ jobs: |
138 | 154 |
|
139 | 155 | prompt: | |
140 | 156 | 1. /run testdriver/onboarding.yml |
| 157 | +
|
| 158 | + - name: Update Check Run |
| 159 | + if: always() |
| 160 | + uses: actions/github-script@v7 |
| 161 | + with: |
| 162 | + script: | |
| 163 | + const checkId = steps['create-check'].outputs.result; |
| 164 | + await github.rest.checks.update({ |
| 165 | + owner: context.repo.owner, |
| 166 | + repo: context.repo.repo, |
| 167 | + check_run_id: checkId, |
| 168 | + status: 'completed', |
| 169 | + conclusion: steps.testdriver.outcome === 'success' ? 'success' : 'failure', |
| 170 | + output: { |
| 171 | + title: 'TestDriver.ai Results', |
| 172 | + summary: steps.testdriver.outcome === 'success' |
| 173 | + ? '✅ All tests passed' |
| 174 | + : '❌ Tests failed' |
| 175 | + } |
| 176 | + }); |
0 commit comments