Skip to content

Commit 334ce0a

Browse files
committed
fix test report for forks
1 parent ea152fe commit 334ce0a

2 files changed

Lines changed: 42 additions & 11 deletions

File tree

.github/workflows/post-test-status.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Post Test Status
22

33
# This workflow runs in the base repo context (with write permissions)
4-
# even for fork PRs, allowing us to post commit statuses.
4+
# even for fork PRs, allowing us to post commit statuses and check runs.
55
#
6-
# Add any status posting for skipped jobs here to avoid "Resource not
7-
# accessible by integration" errors when PRs come from forks.
6+
# Add any status posting or check run creation for fork PRs here to avoid
7+
# "Resource not accessible by integration" errors.
88

99
on:
1010
workflow_run:
@@ -30,19 +30,13 @@ jobs:
3030
const headSha = context.payload.workflow_run.head_sha;
3131
3232
// Define jobs that need a success status posted when skipped
33-
// Format: { jobName: 'GitHub Job Name', statusContext: 'status/context-name', description: 'Description' }
3433
const skippedStatusJobs = [
3534
{
3635
jobName: 'Dash Table Visual Tests',
3736
statusContext: 'percy/dash-table-test',
3837
description: 'Skipped — no dash-table changes'
3938
}
40-
// Add more jobs here as needed:
41-
// {
42-
// jobName: 'Job Name',
43-
// statusContext: 'context/name',
44-
// description: 'Skipped — reason'
45-
// }
39+
// Add more jobs here as needed
4640
];
4741
4842
// Get all jobs for the workflow run
@@ -70,3 +64,39 @@ jobs:
7064
console.log(`Job "${jobName}" status: ${job?.conclusion ?? 'not found'} - no status posted`);
7165
}
7266
}
67+
68+
test-report:
69+
name: Consolidated Test Report (Fork PR)
70+
runs-on: ubuntu-latest
71+
# Only run for fork PRs (non-fork PRs are handled in the main workflow)
72+
if: |
73+
github.event.workflow_run.event == 'pull_request' &&
74+
github.event.workflow_run.head_repository.full_name != github.repository
75+
permissions:
76+
checks: write
77+
actions: read
78+
steps:
79+
- name: Download test results artifact
80+
uses: actions/download-artifact@v4
81+
with:
82+
pattern: '*-results-*'
83+
path: test-results
84+
merge-multiple: false
85+
github-token: ${{ secrets.GITHUB_TOKEN }}
86+
run-id: ${{ github.event.workflow_run.id }}
87+
88+
- name: List downloaded results
89+
run: find test-results -name "*.xml" -type f 2>/dev/null || echo "No XML files found"
90+
91+
- name: Publish Test Report
92+
uses: dorny/test-reporter@v1
93+
if: always()
94+
with:
95+
name: Test Results Summary
96+
path: 'test-results/**/*.xml'
97+
reporter: java-junit
98+
fail-on-error: false
99+
fail-on-empty: false
100+
list-suites: 'failed'
101+
list-tests: 'failed'
102+
max-annotations: '50'

.github/workflows/testing.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,8 @@ jobs:
939939

940940
- name: Publish Test Report
941941
uses: dorny/test-reporter@v1
942-
if: always()
942+
# Skip for fork PRs - handled by post-test-status.yml workflow_run
943+
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
943944
with:
944945
name: Test Results Summary
945946
path: 'test-results/**/*.xml'

0 commit comments

Comments
 (0)