Skip to content

Commit 4738c6d

Browse files
authored
chore(size): keep the size comparison green on fork PRs (#3765)
A fork PR's token is read-only, so posting the report comment answered 403 and the compare job showed as failed on every external PR. The report now also goes to the job summary, and the comment only runs on PRs from this repository.
1 parent e44b2e4 commit 4738c6d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎.github/workflows/size.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@ jobs:
116116
path: scripts/size
117117
- run: node report.mjs size-head.json size-base.json > size-comment.md
118118
working-directory: scripts/size
119-
- uses: actions/github-script@v7
119+
# The job summary carries the report on every PR. The comment only goes
120+
# on PRs from this repository: a fork PR's token is read-only, so
121+
# createComment answered 403 and the job showed as failed on every
122+
# external PR.
123+
- run: cat size-comment.md >> "$GITHUB_STEP_SUMMARY"
124+
working-directory: scripts/size
125+
- if: github.event.pull_request.head.repo.full_name == github.repository
126+
uses: actions/github-script@v7
120127
with:
121128
script: |
122129
const fs = require("fs");

0 commit comments

Comments
 (0)