diff --git a/.github/workflows/screenshot-test-comment.yml b/.github/workflows/screenshot-test-comment.yml index 5b4ae992e9..e63aa3f539 100644 --- a/.github/workflows/screenshot-test-comment.yml +++ b/.github/workflows/screenshot-test-comment.yml @@ -49,8 +49,10 @@ jobs: // Find the ScreenshotTests job let screenshotTestRun = null; + let workflowRunId = null; for (const run of runs.data.workflow_runs) { if (run.name === 'Build jMonkeyEngine') { + workflowRunId = run.id; const jobs = await github.rest.actions.listJobsForWorkflowRun({ owner, repo, @@ -73,9 +75,25 @@ jobs: return; } + core.setOutput('run_url', `https://github.com/${owner}/${repo}/actions/runs/${workflowRunId}`); + // Check if the job failed if (screenshotTestRun.conclusion === 'failure') { - core.setOutput('failed', 'true'); + // Now check if the changed images artifact exists + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner, + repo, + run_id: workflowRunId + }); + + const artifact = artifacts.data.artifacts.find(a => a.name === 'screenshot-test-report'); + if (artifact) { + core.setOutput('failed', 'true'); + core.setOutput('artifact_url', `https://github.com/${owner}/${repo}/actions/runs/${workflowRunId}/artifacts/${artifact.id}`); + } else { + console.log('Job failed but no changed images were generated.'); + core.setOutput('failed', 'false'); + } } else { core.setOutput('failed', 'false'); } @@ -98,7 +116,8 @@ jobs: The purpose of these tests is to ensure that changes introduced in this PR don't break visual features. They are visual unit tests. 📄 **Where to find the report:** - - Go to the (failed run) > Summary > Artifacts > screenshot-test-report + - **[Direct Download: screenshot-test-report](${{ steps.check-status.outputs.artifact_url }})** + - Alternatively, go to the [failed run summary](${{ steps.check-status.outputs.run_url }}) > Artifacts > screenshot-test-report - Download the zip and open jme3-screenshot-tests/build/reports/ScreenshotDiffReport.html ⚠️ **If you didn't expect to change anything visual:**