Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/screenshot-failure-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
RUN_ID: ${{ github.event.workflow_run.id }}
RUN_URL: ${{ github.event.workflow_run.html_url }}
REPORT_BRANCH: screenshot-reports
shell: bash
run: |
Expand Down Expand Up @@ -106,6 +105,7 @@ jobs:
fi

raw_base="https://raw.githubusercontent.com/$GH_REPO/$REPORT_BRANCH/$report_path"
run_url="https://github.com/$GH_REPO/actions/runs/$RUN_ID"
marker='<!-- readme-screenshot-report -->'

summary_line="Screenshot output differs from the committed README image."
Expand All @@ -116,8 +116,7 @@ jobs:
total_pixels="$(jq -r '.totalPixels' screenshot-artifacts/demo-screenshot-report.json)"
ratio="$(jq -r '.ratio * 100' screenshot-artifacts/demo-screenshot-report.json)"
max_ratio="$(jq -r '.maxDiffRatio * 100' screenshot-artifacts/demo-screenshot-report.json)"
summary_line="**Difference:** $(printf '%.4f' "$ratio")% · **Allowed:** $(printf '%.4f' "$max_ratio")%
$changed_pixels of $total_pixels pixels differ."
summary_line="$(printf '**Difference:** %.4f%% · **Allowed:** %.4f%% \\n%s of %s pixels differ.' "$ratio" "$max_ratio" "$changed_pixels" "$total_pixels")"
elif [[ "$report_type" == "size" ]]; then
committed_size="$(jq -r '"\(.committed.width)x\(.committed.height)"' screenshot-artifacts/demo-screenshot-report.json)"
generated_size="$(jq -r '"\(.generated.width)x\(.generated.height)"' screenshot-artifacts/demo-screenshot-report.json)"
Expand All @@ -131,7 +130,7 @@ $changed_pixels of $total_pixels pixels differ."

$summary_line

[View workflow run]($RUN_URL)
[View workflow run]($run_url)

### Visual diff
EOF
Expand Down Expand Up @@ -166,7 +165,7 @@ $changed_pixels of $total_pixels pixels differ."

If the visual change is expected, run:

`npm run screenshots:update`
\`npm run screenshots:update\`
EOF

existing_comment_id="$(
Expand All @@ -187,7 +186,7 @@ $changed_pixels of $total_pixels pixels differ."

$summary_line

[Open pull request](https://github.com/$GH_REPO/pull/$PR_NUMBER) · [View workflow run]($RUN_URL)
[Open pull request](https://github.com/$GH_REPO/pull/$PR_NUMBER) · [View workflow run]($run_url)

### Visual diff
EOF
Expand Down
Loading