Skip to content

Commit e356496

Browse files
Only display the screenshots failed message for runs that create a report (not full compile failures) (#2703)
* Only issue a screenshot comment if the screenshot artefact is produced (not if the whole job failed) * Include direct download link for screenshot report
1 parent b5b4e87 commit e356496

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/screenshot-test-comment.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ jobs:
4949
5050
// Find the ScreenshotTests job
5151
let screenshotTestRun = null;
52+
let workflowRunId = null;
5253
for (const run of runs.data.workflow_runs) {
5354
if (run.name === 'Build jMonkeyEngine') {
55+
workflowRunId = run.id;
5456
const jobs = await github.rest.actions.listJobsForWorkflowRun({
5557
owner,
5658
repo,
@@ -73,9 +75,25 @@ jobs:
7375
return;
7476
}
7577
78+
core.setOutput('run_url', `https://github.com/${owner}/${repo}/actions/runs/${workflowRunId}`);
79+
7680
// Check if the job failed
7781
if (screenshotTestRun.conclusion === 'failure') {
78-
core.setOutput('failed', 'true');
82+
// Now check if the changed images artifact exists
83+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
84+
owner,
85+
repo,
86+
run_id: workflowRunId
87+
});
88+
89+
const artifact = artifacts.data.artifacts.find(a => a.name === 'screenshot-test-report');
90+
if (artifact) {
91+
core.setOutput('failed', 'true');
92+
core.setOutput('artifact_url', `https://github.com/${owner}/${repo}/actions/runs/${workflowRunId}/artifacts/${artifact.id}`);
93+
} else {
94+
console.log('Job failed but no changed images were generated.');
95+
core.setOutput('failed', 'false');
96+
}
7997
} else {
8098
core.setOutput('failed', 'false');
8199
}
@@ -98,7 +116,8 @@ jobs:
98116
The purpose of these tests is to ensure that changes introduced in this PR don't break visual features. They are visual unit tests.
99117
100118
📄 **Where to find the report:**
101-
- Go to the (failed run) > Summary > Artifacts > screenshot-test-report
119+
- **[Direct Download: screenshot-test-report](${{ steps.check-status.outputs.artifact_url }})**
120+
- Alternatively, go to the [failed run summary](${{ steps.check-status.outputs.run_url }}) > Artifacts > screenshot-test-report
102121
- Download the zip and open jme3-screenshot-tests/build/reports/ScreenshotDiffReport.html
103122
104123
⚠️ **If you didn't expect to change anything visual:**

0 commit comments

Comments
 (0)