From 99b2da62fee54e0242517dc92c871e6056949d65 Mon Sep 17 00:00:00 2001 From: Sean Steimer Date: Fri, 8 Aug 2025 12:22:04 -0700 Subject: [PATCH] chore: build --- .github/workflows/main.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bbc24a8..b6e0a01 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -2,12 +2,19 @@ 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: @@ -15,3 +22,24 @@ jobs: - 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