Skip to content

Commit 9f70f03

Browse files
committed
ci: download only expected size artifacts outside the checkout
1 parent 97d8eee commit 9f70f03

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

.github/workflows/size-comment.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,37 @@ jobs:
2525
sparse-checkout-cone-mode: false
2626
persist-credentials: false
2727

28-
- name: ⏬ Download artifacts from workflow run
28+
- name: ⏬ Download head stats
2929
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
3030
with:
3131
github-token: ${{ secrets.GITHUB_TOKEN }}
3232
run-id: ${{ github.event.workflow_run.id }}
33-
path: .
33+
name: head-stats
34+
path: artifacts/head-stats
35+
36+
- name: ⏬ Download base stats
37+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
38+
with:
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
run-id: ${{ github.event.workflow_run.id }}
41+
name: base-stats
42+
path: artifacts/base-stats
43+
44+
- name: ⏬ Download PR number
45+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
46+
if: false
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
run-id: ${{ github.event.workflow_run.id }}
50+
name: pr-number
51+
path: artifacts/pr-number
3452

3553
- name: 🔍 Get PR number from artifact
3654
id: pr
3755
if: false
3856
run: |
39-
if [ -f pr-number/pr-number.txt ]; then
40-
PR_NUMBER=$(cat pr-number/pr-number.txt)
57+
if [ -f artifacts/pr-number/pr-number.txt ]; then
58+
PR_NUMBER=$(cat artifacts/pr-number/pr-number.txt)
4159
echo "result=$PR_NUMBER" >> $GITHUB_OUTPUT
4260
echo "Found PR number: $PR_NUMBER"
4361
else
@@ -47,6 +65,8 @@ jobs:
4765
4866
- name: 📊 Generate size comparison
4967
id: sizes
68+
env:
69+
STATS_DIR: ${{ github.workspace }}/artifacts
5070
run: |
5171
COMMENT=$(node scripts/parse-sizes.ts nuxi nuxt-cli create-nuxt)
5272
echo "comment<<EOF" >> $GITHUB_OUTPUT

scripts/parse-sizes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ if (isMainModule) {
152152
process.exit(1)
153153
}
154154

155-
const rootDir = fileURLToPath(new URL('..', import.meta.url))
156-
const comment = generateSizeComment(packages, rootDir)
155+
const statsDir = process.env.STATS_DIR || fileURLToPath(new URL('..', import.meta.url))
156+
const comment = generateSizeComment(packages, statsDir)
157157
console.log(comment)
158158
}

0 commit comments

Comments
 (0)