From d2d8146705a56ff3994e023f35ce02d50fe46d05 Mon Sep 17 00:00:00 2001 From: topcoder1 Date: Sat, 23 May 2026 22:53:05 -0700 Subject: [PATCH] =?UTF-8?q?ci(lint):=20skip=20prettier=20on=20push=20event?= =?UTF-8?q?s=20=E2=80=94=20autofix=20handles=20main=20drift?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many fleet repos have pre-existing markdown formatting drift (~20-70 files per repo failing prettier). The reusable's prettier step ran on push:main events with no `prettier_changed_only` benefit (no PR context), so every post-merge lint run failed. Then prettier-autofix fired, pushed a fix commit, triggering another push:main, repeat. webcrawl saw 24 of 59 Lint runs fail in a 7d window from this loop. Gating prettier to pull_request events only: - Removes the loop (push:main never fails Lint on formatting) - Preserves PR-time prettier checking (which IS useful — it gates new bad files from landing) - Prettier-autofix workflow already handles main-branch drift via its own push:main trigger Actionlint and shellcheck remain on both event types — those are not in the autofix loop. Estimated savings: ~$2-3/mo across the fleet (~20 Lint callers). Plus reduces alarm fatigue from constant Lint failures on main. Auto-merge rationale: change to shared reusable workflow that ~20 callers reference. Touches .github/workflows/** which is high-risk per claude-author-automerge.yml policy — manual click-merge required. actionlint passes. Backwards-compatible (existing callers see prettier fire less often, never more). Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/lint.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 99c0b7e..a29754b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,11 +27,18 @@ name: Lint # - prettier auto-installs the target repo's deps if a package.json exists, # so prettier plugins (prettier-plugin-svelte etc.) resolve correctly. # Skip with `install_node_deps: false` for plain markdown-only repos. +# - prettier runs on pull_request events ONLY. Push events (including +# post-merge push:main) skip prettier entirely. Rationale: prettier on +# push:main provides zero value (the merge already landed) and creates a +# feedback loop — prettier-autofix fires on push:main, pushes a fix +# commit, which triggers another push:main, repeat. The prettier-autofix +# workflow already handles main-branch formatting drift. Actionlint and +# shellcheck are NOT gated this way — they run on both event types. # - prettier in PR mode checks ONLY files added/modified/renamed by the PR -# (intersected with `markdown_glob`). On push events it scans the full -# glob. Set `prettier_changed_only: false` to scan the full glob on PRs -# too. Rationale: a single badly-formatted file landing on main otherwise -# poisons every subsequent docs PR's lint check across the fleet. +# (intersected with `markdown_glob`). Set `prettier_changed_only: false` +# to scan the full glob on PRs instead. Rationale: a single +# badly-formatted file landing on main otherwise poisons every subsequent +# docs PR's lint check across the fleet. # - shellcheck on .sh files is OFF by default for the same reason as # actionlint's shellcheck: most repos have pre-existing style/info # drift. When opted in, defaults to severity=error so only real bugs @@ -139,7 +146,12 @@ jobs: prettier: name: prettier (markdown) - if: ${{ format('{0}', inputs.run_prettier) != 'false' }} + # Skip entirely on push events — prettier-autofix handles main-branch + # drift and push events have no PR context for changed-only mode anyway. + # Running prettier on push:main caused a feedback loop: prettier fails → + # prettier-autofix pushes a fix commit → another push:main → repeat. + # Actionlint and shellcheck are NOT gated this way (they remain on both). + if: ${{ github.event_name == 'pull_request' && format('{0}', inputs.run_prettier) != 'false' }} runs-on: ubuntu-latest permissions: contents: read