Skip to content

Commit 2f11a45

Browse files
jh-leongsxzz
andauthored
ci: correct PR number retrieval to fix size-report action (#11223)
Co-authored-by: 三咲智子 Kevin Deng <[email protected]>
1 parent f2acd51 commit 2f11a45

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

.github/workflows/size-data.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,13 @@ jobs:
4141
with:
4242
name: size-data
4343
path: temp/size
44+
45+
- name: Save PR number
46+
if: ${{github.event_name == 'pull_request'}}
47+
run: echo ${{ github.event.number }} > ./pr.txt
48+
49+
- uses: actions/upload-artifact@v4
50+
if: ${{github.event_name == 'pull_request'}}
51+
with:
52+
name: pr-number
53+
path: pr.txt

.github/workflows/size-report.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ jobs:
3535
- name: Install dependencies
3636
run: pnpm install
3737

38+
- name: Download PR number
39+
uses: dawidd6/action-download-artifact@v3
40+
with:
41+
name: pr-number
42+
run_id: ${{ github.event.workflow_run.id }}
43+
path: /tmp/pr-number
44+
45+
- name: Read PR Number
46+
id: pr-number
47+
uses: juliangruber/read-file-action@v1
48+
with:
49+
path: /tmp/pr-number/pr.txt
50+
3851
- name: Download Size Data
3952
uses: dawidd6/action-download-artifact@v6
4053
with:
@@ -55,10 +68,18 @@ jobs:
5568
- name: Prepare report
5669
run: pnpm tsx scripts/size-report.ts > size-report.md
5770

71+
- name: Read Size Report
72+
id: size-report
73+
uses: juliangruber/read-file-action@v1
74+
with:
75+
path: ./size-report.md
76+
5877
- name: Create Comment
59-
uses: thollander/actions-[email protected]
78+
uses: actions-cool/maintain-one-comment@v3
6079
with:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
filePath: size-report.md
63-
pr_number: ${{ github.event.workflow_run.pull_requests[0].number }}
64-
comment_tag: VUE_CORE_SIZE
80+
token: ${{ secrets.GITHUB_TOKEN }}
81+
number: ${{ steps.pr-number.outputs.content }}
82+
body: |
83+
${{ steps.size-report.outputs.content }}
84+
<!-- VUE_CORE_SIZE -->
85+
body-include: '<!-- VUE_CORE_SIZE -->'

0 commit comments

Comments
 (0)