Skip to content

Switch to post-merge air formatting on main - #135

Merged
eduaguilera merged 2 commits into
mainfrom
chore/postmerge-air-format
Aug 13, 2026
Merged

Switch to post-merge air formatting on main#135
eduaguilera merged 2 commits into
mainfrom
chore/postmerge-air-format

Conversation

@lbm364dl

@lbm364dl lbm364dl commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Implements the post-merge-only option from #134. Rebased onto current main
(the branch predated ~630 merges) and wired to a token that can actually push.

What changes

  • Remove the pre-merge format-suggest workflow.
  • Add format-main — on push to main, install air, run air format .,
    and commit any changes back via git-auto-commit-action.
  • Docs (CLAUDE.md, .github/CONTRIBUTING.md): five CI checks rather than
    six, and formatting documented as a local requirement with no pre-merge gate —
    run air format . yourself so the diff under review is the diff that lands
    and main does not accumulate formatting-only commits.
  • The original commit also edited .github/copilot-instructions.md; that file
    has since been deleted from main, so the hunk is dropped.

Repo setting required before this works

main is protected by the "Not push in main" ruleset (pull_request rule,
1 approval). Its bypass list does not include github-actions, so the default
GITHUB_TOKEN cannot push. The job therefore checks out with
secrets.FORMAT_BOT_TOKEN.

That secret is a fine-grained PAT owned by a repository admin — repository
eduaguilera/whep, permission Contents: Read and write — and it is already
configured. Repository admins bypass the ruleset, so the ruleset itself needs no
change. The first job step fails with an explicit message when the secret is
missing, instead of dying on an opaque 403 at push time.

The commit carries [skip ci] so a formatting-only change does not re-run the
five-platform check suite. Unlike a GITHUB_TOKEN commit, a PAT-authored one
would trigger downstream workflows — drop [skip ci] if that is ever wanted.

Smoke test built into this PR

The second commit adds whitespace-only noise to R/validation_helpers.R, so
the first push to main gives format-main something to fix. Verified
locally: air 0.9.0 restores the file byte-for-byte, and lintr reports no lints,
because the deviations are confined to the four linters .lintr disables
precisely because air owns them. The auto-format commit on main should
therefore revert exactly that hunk and nothing else.

Note: format-suggest fails on this PR by design. It is a pull_request_target
workflow, so GitHub runs the copy from the base branch — it sees the deliberate
mis-format and objects. Deleting it is the point of this PR.

🤖 Generated with Claude Code

Replace the pre-merge format-suggest check with a format-main workflow
that runs air format . on push to main and commits any changes back.
Contributors no longer need a green formatting gate, but are still
expected to run air format . locally (see CLAUDE.md) so the diff under
review is the diff that lands and main stays free of formatting-only
commits.

- Remove .github/workflows/format-suggest.yaml.
- Add .github/workflows/format-main.yaml (push: main, commit back). It
  checks out with FORMAT_BOT_TOKEN, a fine-grained PAT with Contents
  read and write owned by a repository admin, because the default
  GITHUB_TOKEN is not on the bypass list of the "Not push in main"
  ruleset and so cannot push. The job fails early, with an explanatory
  message, when that secret is unset.
- Update CLAUDE.md and .github/CONTRIBUTING.md: five CI checks rather
  than six, and formatting documented as a local requirement with no
  pre-merge gate.

Implements the post-merge-only option from #134.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@eduaguilera
eduaguilera force-pushed the chore/postmerge-air-format branch from 215083a to 64f900a Compare August 13, 2026 09:21
Whitespace-only noise (comma spacing and indentation) in
R/validation_helpers.R, so the first push to main after this merges gives
format-main something to fix.

Verified locally: air 0.9.0 restores the file byte-for-byte, and lintr
reports no lints, because the deviations are confined to the four linters
disabled in .lintr precisely because air owns them.

The format-main commit on main should therefore revert exactly this hunk
and nothing else. The pre-merge format-suggest run on this PR fails by
design: it comes from the base branch, and deleting it is the point of
this PR.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread R/validation_helpers.R
Comment on lines +11 to +12
.conservation_rel_error <- function(gridded,reference) {
dplyr::case_when(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change
.conservation_rel_error <- function(gridded,reference) {
dplyr::case_when(
.conservation_rel_error <- function(gridded, reference) {
dplyr::case_when(

Comment thread R/validation_helpers.R
Comment on lines +14 to +15
gridded > 0 ~ Inf,
.default = 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change
gridded > 0 ~ Inf,
.default = 0
gridded > 0 ~ Inf,
.default = 0

@eduaguilera
eduaguilera merged commit 88265b9 into main Aug 13, 2026
9 of 10 checks passed
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.

2 participants