Skip to content

Commit

Permalink
Expand size-limit workflow to run basic version on forks (withastro#1142
Browse files Browse the repository at this point in the history
)
  • Loading branch information
delucis authored Nov 24, 2023
1 parent acb61ca commit 4d7ac0d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,27 @@ concurrency:
cancel-in-progress: true

jobs:
# This basic check runs size-limit for the current branch.
# It will fail if the branch pushes the size over the specified budget.
size-limit-basic:
if: ${{ github.event.pull_request.head.repo.full_name != 'withastro/starlight' }}
name: Check build output is within performance budget (forks)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- run: 'pnpm build:examples'
- run: pnpm size

# This check cannot run in forks, so is only run for PRs from this repo.
# It will run size-limit for both `main` and the PR branch and comment in the PR with changes.
size-limit:
if: ${{ github.event.pull_request.head.repo.full_name == 'withastro/starlight' }}
name: Check build output is within performance budget
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PNPM
uses: pnpm/action-setup@v2

- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- name: Run size-limit
uses: andresz1/size-limit-action@dd31dce7dcc72a041fd3e49abf0502b13fc4ce05
with:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
{
"name": "/index.html",
"path": "examples/basics/dist/index.html",
"limit": "14 kB"
"limit": "10 kB"
},
{
"name": "/_astro/*.js",
"path": "examples/basics/dist/_astro/*.js",
"limit": "20 kB"
"limit": "21 kB"
},
{
"name": "/_astro/*.css",
"path": "examples/basics/dist/_astro/*.css",
"limit": "10 kB"
"limit": "14 kB"
}
]
}

0 comments on commit 4d7ac0d

Please sign in to comment.