Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,44 @@ name: Build
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint
- run: npm run test
- run: npm run build
- name: Check gzipped dist size
run: |
gz_size=$(gzip -c dist/faintly.js | wc -c)
echo "Gzipped size: ${gz_size} bytes"
if [ "$gz_size" -gt 5120 ]; then
echo "Error: dist/faintly.js gzipped size ${gz_size} exceeds 5KB (5120 bytes)"
exit 1
fi
- name: Commit dist if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A dist
if ! git diff --cached --quiet; then
git commit -m "chore(build): update dist [skip ci]"
git push || echo "Push failed (likely due to permissions or fork)."
else
echo "No changes in dist to commit."
fi
continue-on-error: true