4343 GH_REPO : ${{ github.repository }}
4444 PR_NUMBER : ${{ github.event.workflow_run.pull_requests[0].number }}
4545 RUN_ID : ${{ github.event.workflow_run.id }}
46- RUN_URL : ${{ github.event.workflow_run.html_url }}
4746 REPORT_BRANCH : screenshot-reports
4847 shell : bash
4948 run : |
@@ -106,6 +105,7 @@ jobs:
106105 fi
107106
108107 raw_base="https://raw.githubusercontent.com/$GH_REPO/$REPORT_BRANCH/$report_path"
108+ run_url="https://github.com/$GH_REPO/actions/runs/$RUN_ID"
109109 marker='<!-- readme-screenshot-report -->'
110110
111111 summary_line="Screenshot output differs from the committed README image."
@@ -116,8 +116,7 @@ jobs:
116116 total_pixels="$(jq -r '.totalPixels' screenshot-artifacts/demo-screenshot-report.json)"
117117 ratio="$(jq -r '.ratio * 100' screenshot-artifacts/demo-screenshot-report.json)"
118118 max_ratio="$(jq -r '.maxDiffRatio * 100' screenshot-artifacts/demo-screenshot-report.json)"
119- summary_line="**Difference:** $(printf '%.4f' "$ratio")% · **Allowed:** $(printf '%.4f' "$max_ratio")%
120- $changed_pixels of $total_pixels pixels differ."
119+ summary_line="$(printf '**Difference:** %.4f%% · **Allowed:** %.4f%% \\n%s of %s pixels differ.' "$ratio" "$max_ratio" "$changed_pixels" "$total_pixels")"
121120 elif [[ "$report_type" == "size" ]]; then
122121 committed_size="$(jq -r '"\(.committed.width)x\(.committed.height)"' screenshot-artifacts/demo-screenshot-report.json)"
123122 generated_size="$(jq -r '"\(.generated.width)x\(.generated.height)"' screenshot-artifacts/demo-screenshot-report.json)"
@@ -131,7 +130,7 @@ $changed_pixels of $total_pixels pixels differ."
131130
132131 $summary_line
133132
134- [View workflow run]($RUN_URL )
133+ [View workflow run]($run_url )
135134
136135 ### Visual diff
137136 EOF
@@ -166,7 +165,7 @@ $changed_pixels of $total_pixels pixels differ."
166165
167166 If the visual change is expected, run:
168167
169- ` npm run screenshots:update`
168+ \ `npm run screenshots:update\ `
170169 EOF
171170
172171 existing_comment_id="$(
@@ -187,7 +186,7 @@ $changed_pixels of $total_pixels pixels differ."
187186
188187 $summary_line
189188
190- [Open pull request](https://github.com/$GH_REPO/pull/$PR_NUMBER) · [View workflow run]($RUN_URL )
189+ [Open pull request](https://github.com/$GH_REPO/pull/$PR_NUMBER) · [View workflow run]($run_url )
191190
192191 ### Visual diff
193192 EOF
0 commit comments