Skip to content

Commit a05cd2e

Browse files
Fix for test results not displaying in checks tab (#1728)
1 parent c1eacb6 commit a05cd2e

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

.github/workflows/testdriver.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ env:
1111
NODE_VERSION: 22
1212

1313
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
1616
checks: write
17+
actions: read
1718

1819
jobs:
1920
context:
@@ -46,7 +47,22 @@ jobs:
4647
run_testdriver:
4748
name: Run TestDriver.ai
4849
runs-on: windows-latest
50+
if: github.event.workflow_run.conclusion == 'success'
4951
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+
5066
- uses: testdriverai/action@main
5167
id: testdriver
5268
env:
@@ -138,3 +154,23 @@ jobs:
138154
139155
prompt: |
140156
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

Comments
 (0)