Repository navigation
ci(auto-format): run the format step through the steps script - #496
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused refactor preserves existing behavior and includes coverage for its key paths.
Review effort: Balanced
Findings: None
What changed in this PR
Moves auto-format workflow logic into the shared step script while preserving patch and output behavior.
Changes:
- Adds the
formatscript subcommand. - Simplifies the workflow step.
- Tests staging, no-op, and failure behavior.
| File | Description |
|---|---|
.github/scripts/auto-format-steps.ts |
Implements the format subcommand. |
.github/workflows/auto-format.yml |
Invokes the new subcommand. |
test/scripts/auto-format-steps.test.ts |
Covers format-step behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The format job's one multi-line run step moves into auto-format-steps.ts as the format subcommand, beside push: the same commands, GITHUB_OUTPUT lines, log line, and patch file. On a runner, one difference: a failed git rev-parse HEAD ends the step with git's status, where the shell wrote an empty head= and went on. Off a runner, two more: an unset RUNNER_TEMP ends the step before any patch is written, and a patch file removed under the step ends it rather than reading as changed=false.
Vivswan
force-pushed
the
ci/auto-format-step-script
branch
from
October 6, 2026 10:34
c04c21d to
f12437d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before
After
How
formatsubcommand ofauto-format-steps.ts: the same commands, outputs, log line, and patch file.git rev-parse HEADends the step with git's status, where the shell wrote an emptyhead=.RUNNER_TEMPends the step before any patch, and a patch file removed under the step ends it instead of readingchanged=false.@actions/coretosrc/action/and the push job that runs this file installs nothing, so the repo's helpers stay.Proof
bun test test/scripts/auto-format-steps.test.ts test/workflows/repo-owned-workflows.test.ts16 pass (3 new, red before the subcommand existed).grep -c 'run: |' .github/workflows/auto-format.yml1 before, 0 after.Technical details
reset -qplusadd -uadmits to the patch (modifications and deletions of tracked files, never an addition, staged earlier or made by the formatter), and that a failing formatter stops the step afterhead=with the formatter's status and no patch file.git diff --numstat origin/main...HEAD): script +29/-6, workflow +1/-16, test +65/-2..github/scripts/auto-format-steps.ts,.github/workflows/auto-format.yml,test/scripts/auto-format-steps.test.ts.