Skip to content

ci(lint): skip prettier on push events — autofix handles main drift#75

Open
topcoder1 wants to merge 1 commit into
mainfrom
ci/lint-skip-prettier-on-push
Open

ci(lint): skip prettier on push events — autofix handles main drift#75
topcoder1 wants to merge 1 commit into
mainfrom
ci/lint-skip-prettier-on-push

Conversation

@topcoder1
Copy link
Copy Markdown
Owner

Summary

  • The loop being fixed: The lint reusable's prettier job ran on push:main events, scanning the full glob (no PR context for prettier_changed_only). Fleet repos with pre-existing markdown formatting drift (~20-70 files) fail every push:main lint run → prettier-autofix.yml fires, pushes a fix commit → triggers another push:main → repeat. webcrawl had 24 Lint failures out of 59 runs in a recent 7-day window from this loop alone.
  • The fix: Added github.event_name == 'pull_request' to the prettier job's if: condition (combined with the existing run_prettier check). Prettier now only runs on PR events; push events skip it entirely.
  • Backwards-compatible: Existing callers see prettier fire less often, never more. The prettier_changed_only input and all other inputs are unchanged. Actionlint and shellcheck remain on both event types.

Why this is safe

  • Prettier on push:main can't gate anything — the merge already happened.
  • prettier-autofix.yml already handles main-branch formatting drift on push:main — prettier's job is now just catching new bad files before they land (PR-only).
  • The prettier_changed_only behavior on PRs is fully preserved.

What changes

Before: prettier job if: = format('{0}', inputs.run_prettier) != 'false' (fires on both PR and push events)

After: prettier job if: = github.event_name == 'pull_request' && format('{0}', inputs.run_prettier) != 'false' (fires on PR events only)

The header comment block is also updated to document this behavior and the rationale.

Fleet impact

~20 fleet repos use the lint reusable via topcoder1/ci-workflows. All benefit immediately after this merges — no caller changes needed. Estimated savings: ~$2-3/mo in CI minutes. More importantly, eliminates the Lint-failure alarm fatigue on main.

Test plan

  • Self-test of lint.yml on pull_request trigger: prettier job runs and checks changed markdown files (unchanged behavior)
  • Self-test of lint.yml on push:main trigger (after this PR merges): prettier job is skipped; actionlint still runs
  • actionlint on the modified workflow: passes (verified locally with actionlint v1.7.12 — zero errors)
  • Spot-check a fleet repo (e.g. webcrawl): after next push:main, confirm Lint no longer shows a prettier failure

Auto-merge rationale: Touches .github/workflows/** which is high-risk per claude-author-automerge.yml policy — manual click-merge required. Change is backwards-compatible (prettier fires less often, never more). Actionlint clean. No caller changes needed.

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Coverage Floor — mode: enforce

metric value
measured 100.0%
floor (current) 99.0%
target 100.0%
last bumped 2026-05-12

@claude
Copy link
Copy Markdown

claude Bot commented May 24, 2026

Flagged 1 issue: the prettier_changed_only input description (line ~68, not in diff) still says "Push events always scan the full glob" — but push events now skip prettier entirely. Should read something like "Not applicable on push events (prettier is skipped)." No logic bugs found; the github.event_name gate is correct and the reusable-workflow event-name behavior is handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant