Skip to content

Commit 3ef0dfe

Browse files
committed
ci: re-combine size compare workflow
1 parent a1684c0 commit 3ef0dfe

File tree

2 files changed

+34
-55
lines changed

2 files changed

+34
-55
lines changed

.github/workflows/size-comment.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/size.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1-
name: size-build
1+
name: size
22
on:
3-
pull_request:
3+
# this action will error unless run in a pr context
4+
pull_request_target:
45
branches:
56
- main
67

78
env:
89
BUNDLE_SIZE: true
910

10-
permissions:
11-
contents: read
11+
permissions: {}
1212

1313
jobs:
1414
# Build current and upload stats.json
15+
# You may replace this with your own build method. All that
16+
# is required is that the stats.json be an artifact
1517
build-head:
1618
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
1721
steps:
1822
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23+
with:
24+
ref: ${{ github.event.pull_request.head.sha }}
1925
- run: corepack enable
2026
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2127
with:
@@ -34,8 +40,12 @@ jobs:
3440
path: ./packages/*/stats.json
3541

3642
# Build base for comparison and upload stats.json
43+
# You may replace this with your own build method. All that
44+
# is required is that the stats.json be an artifact
3745
build-base:
3846
runs-on: ubuntu-latest
47+
permissions:
48+
contents: read
3949
steps:
4050
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
4151
with:
@@ -56,3 +66,23 @@ jobs:
5666
with:
5767
name: base-stats
5868
path: ./packages/*/stats.json
69+
70+
# run the action against the stats.json files
71+
compare:
72+
runs-on: ubuntu-latest
73+
needs: [build-base, build-head]
74+
permissions:
75+
pull-requests: write
76+
issues: write
77+
strategy:
78+
matrix:
79+
package: [nuxi, nuxt-cli, create-nuxt]
80+
steps:
81+
- name: ⏬ Download stats.json
82+
uses: actions/download-artifact@v5
83+
- uses: twk3/[email protected]
84+
with:
85+
title: ${{ matrix.package }} size comparison
86+
github-token: ${{ secrets.GITHUB_TOKEN }}
87+
current-stats-json-path: ./head-stats/${{ matrix.package }}/stats.json
88+
base-stats-json-path: ./base-stats/${{ matrix.package }}/stats.json

0 commit comments

Comments
 (0)