styleproof 3.15.0 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.16.0] - 2026-07-05
11
+
12
+ ### Added
13
+
14
+ - **The scaffolded PR workflow prunes its own report branch, out of the box.**
15
+ `styleproof-init`'s `.github/workflows/styleproof.yml` now also runs on
16
+ `pull_request: closed`: when a PR closes, a `prune` job removes that PR's `pr-<n>/`
17
+ folder from the report branch (`styleproof-reports`), so the branch no longer grows
18
+ without bound as PRs come and go — no adopter has to remember to garbage-collect it.
19
+ The report job is unchanged, only guarded to skip the close event. Covered by the
20
+ `styleproof-init` workflow test.
21
+
10
22
  ## [3.15.0] - 2026-07-05
11
23
 
12
24
  ### Changed
@@ -345,7 +345,9 @@ const CI_WORKFLOW = `name: StyleProof
345
345
  # report without a browser;
346
346
  # - on cache miss, CI recaptures both sides in one pinned environment so the
347
347
  # comparison stays valid.
348
- on: pull_request
348
+ on:
349
+ pull_request:
350
+ types: [opened, synchronize, reopened, closed]
349
351
 
350
352
  permissions:
351
353
  contents: write
@@ -355,6 +357,8 @@ permissions:
355
357
 
356
358
  jobs:
357
359
  styleproof:
360
+ # Report on open/update; the prune job below handles close.
361
+ if: github.event.action != 'closed'
358
362
  runs-on: ubuntu-latest
359
363
  steps:
360
364
  - uses: actions/checkout@v4
@@ -408,6 +412,41 @@ ${PM.setup}
408
412
  baseline-dir: __stylemaps__/base
409
413
  fresh-dir: __stylemaps__/head
410
414
  require-approval: true
415
+
416
+ prune:
417
+ # PR closed: drop its pr-<n>/ folder from the report branch so the branch
418
+ # never grows without bound. Keep BRANCH in sync with the report-branch
419
+ # input above (default: styleproof-reports).
420
+ if: github.event.action == 'closed'
421
+ runs-on: ubuntu-latest
422
+ permissions:
423
+ contents: write
424
+ steps:
425
+ - name: Prune this PR's report folder
426
+ shell: bash
427
+ env:
428
+ GH_TOKEN: \${{ github.token }}
429
+ BRANCH: styleproof-reports
430
+ PR: \${{ github.event.pull_request.number }}
431
+ run: |
432
+ set -euo pipefail
433
+ REMOTE="https://x-access-token:\${GH_TOKEN}@github.com/\${{ github.repository }}.git"
434
+ if ! git ls-remote --exit-code "$REMOTE" "refs/heads/$BRANCH" >/dev/null 2>&1; then
435
+ echo "No $BRANCH branch yet — nothing to prune."; exit 0
436
+ fi
437
+ TMP="$(mktemp -d)"
438
+ # Blobless clone keeps this fast; a very large report branch may prefer
439
+ # a --no-checkout plumbing rewrite instead.
440
+ git clone --filter=blob:none --single-branch --branch "$BRANCH" "$REMOTE" "$TMP"
441
+ cd "$TMP"
442
+ if [ ! -d "pr-$PR" ]; then
443
+ echo "No pr-$PR/ folder — nothing to prune."; exit 0
444
+ fi
445
+ git config user.name "github-actions[bot]"
446
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
447
+ git rm -r --quiet "pr-$PR"
448
+ git commit -m "chore(styleproof): prune report for closed PR #$PR"
449
+ git push origin "$BRANCH"
411
450
  `;
412
451
 
413
452
  function writeFileSafe(file, contents, { force: f } = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styleproof",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "description": "Catch every CSS change before it ships — review PRs and certify refactors by the browser's computed styles, not pixels. Works with any styling system.",
5
5
  "keywords": [
6
6
  "playwright",