Skip to content

feat(ci): autoformat commits#6653

Closed
LesnyRumcajs wants to merge 1 commit intomainfrom
auto-format-ci
Closed

feat(ci): autoformat commits#6653
LesnyRumcajs wants to merge 1 commit intomainfrom
auto-format-ci

Conversation

@LesnyRumcajs
Copy link
Copy Markdown
Member

@LesnyRumcajs LesnyRumcajs commented Feb 26, 2026

Summary of changes

Dependabot (or we) sometime push unformatted code; it's probably easier to just commit a fix from a bot than to wait for the CI to fail, notice it and run the format command yourself.

Changes introduced in this pull request:

  • introduced a workflow that should push formatting changes if needed. Might not work though, difficult to test locally. We'll iterate. :)

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Chores
    • Added an automated formatting workflow that runs on every push, applies formatting, and commits changes only when differences are detected.
    • Includes concurrency control and safeguards to avoid re-triggering from its own commits, and uses secure authentication to perform conditional commits and pushes.

@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner February 26, 2026 10:00
@LesnyRumcajs LesnyRumcajs requested review from akaladarshi and sudo-shashank and removed request for a team February 26, 2026 10:00
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2acce58 and b983a85.

📒 Files selected for processing (1)
  • .github/workflows/auto-format.yml

Walkthrough

Adds a new GitHub Actions workflow .github/workflows/auto-format.yml that runs on every push, authenticates as a GitHub App, checks out the repo, runs mise format via mise-action, detects formatting changes, and conditionally commits/pushes a bot commit when modifications are found.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/auto-format.yml
New workflow: triggers on push, guards against reruns, creates GitHub App token (LESHY_APP_ID / LESHY_APP_PRIVATE_KEY), checks out full repo history, runs mise-action to install/run mise format, detects repository changes, and conditionally commits/pushes [LeshyBot] Apply automatic formatting when diffs exist.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer Push
    participant Actions as GitHub Actions
    participant App as GitHub App
    participant Checkout as actions/checkout
    participant Mise as mise-action
    participant Git as Git (commit/push)

    Dev->>Actions: push event (any branch)
    Actions->>App: create App token (LESHY_APP_ID / LESHY_APP_PRIVATE_KEY)
    Actions->>Checkout: checkout repo (full history)
    Actions->>Mise: install tooling & run "mise format"
    Mise->>Actions: report changes (git diff)
    alt changes found
        Actions->>Git: commit "[LeshyBot] Apply automatic formatting" & push
    else no changes
        Actions-->>Dev: no-op (skip commit)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

github_actions

Suggested reviewers

  • akaladarshi
  • sudo-shashank
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ci): autoformat commits' clearly and concisely describes the main change—adding CI automation for code formatting—which matches the changeset that introduces a GitHub Actions workflow for automatic formatting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch auto-format-ci

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/auto-format.yml:
- Around line 31-33: The workflow step currently invokes the Mise formatter with
the command "mise format" (action jdx/mise-action@v3); update that run command
to use "mise fmt" so it matches project docs and CONTRIBUTING.md/AGENTS.md
conventions, ensuring the workflow uses the documented formatter invocation.
- Around line 46-49: The workflow config sets git user.name ("git config
user.name \"LeshyBot\"") but omits user.email, causing commits to fail in CI;
update the auto-format job to set both git config user.name and git config
user.email (e.g., a LeshyBot email) before running git add/commit/push so
commits succeed in the auto-format step.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd4826 and 37ecffa.

📒 Files selected for processing (1)
  • .github/workflows/auto-format.yml

Comment thread .github/workflows/auto-format.yml
Comment thread .github/workflows/auto-format.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
.github/workflows/auto-format.yml (2)

46-49: ⚠️ Potential issue | 🔴 Critical

Set git user.email before committing.

Line 46 sets only user.name; git commit may fail in CI without an email identity.

Suggested patch
       - name: Commit and push formatting changes
         if: steps.check-changes.outputs.has_changes == 'true'
         run: |
           git config user.name "LeshyBot"
+          git config user.email "leshybot@users.noreply.github.com"
           git add .
           git commit -m "[LeshyBot] Apply automatic formatting"
           git push
#!/bin/bash
# Verify git identity config present in this workflow segment.
cat -n .github/workflows/auto-format.yml | sed -n '43,52p'
rg -n 'git config user\.(name|email)' .github/workflows/auto-format.yml
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-format.yml around lines 46 - 49, The workflow
currently sets git config user.name "LeshyBot" but not user.email, which can
make git commit fail in CI; modify the step that contains git config user.name
"LeshyBot" and git commit -m "[LeshyBot] Apply automatic formatting" to also set
git config user.email (e.g., use a noreply address derived from the actor or a
repository bot email) before running git add/commit/push so Git has a complete
committer identity.

31-33: ⚠️ Potential issue | 🔴 Critical

Use mise fmt instead of mise format.

Line 32 uses mise format, which can fail if the project task is fmt (and prevents the auto-fix workflow from doing its core job).

Suggested patch
-# This workflow runs on every push and automatically applies formatting using mise format
+# This workflow runs on every push and automatically applies formatting using mise fmt
@@
-      - run: mise format
+      - run: mise fmt
#!/bin/bash
# Verify formatter command conventions used by project docs and this workflow.
find . -name "AGENTS.md" -type f -exec rg -n 'mise\s+(fmt|format)' {} +
rg -n 'run:\s*mise\s+(fmt|format)' .github/workflows/auto-format.yml

Based on learnings: Run mise fmt to format code before submission.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-format.yml around lines 31 - 33, Replace the
incorrect formatter command "mise format" with the project's canonical "mise
fmt" in the CI workflow step that runs the jdx/mise-action; locate the job step
using the action identifier jdx/mise-action@v3 and change the run command from
"mise format" to "mise fmt" so the auto-format workflow calls the project's
actual formatter task.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/auto-format.yml:
- Around line 46-49: The workflow currently sets git config user.name "LeshyBot"
but not user.email, which can make git commit fail in CI; modify the step that
contains git config user.name "LeshyBot" and git commit -m "[LeshyBot] Apply
automatic formatting" to also set git config user.email (e.g., use a noreply
address derived from the actor or a repository bot email) before running git
add/commit/push so Git has a complete committer identity.
- Around line 31-33: Replace the incorrect formatter command "mise format" with
the project's canonical "mise fmt" in the CI workflow step that runs the
jdx/mise-action; locate the job step using the action identifier
jdx/mise-action@v3 and change the run command from "mise format" to "mise fmt"
so the auto-format workflow calls the project's actual formatter task.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37ecffa and 0aacc5c.

📒 Files selected for processing (1)
  • .github/workflows/auto-format.yml

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
.github/workflows/auto-format.yml (2)

31-34: ⚠️ Potential issue | 🟠 Major

Use mise fmt on Line 33.

mise format is inconsistent with this repo’s formatter entrypoint and can fail when only fmt is defined.

#!/bin/bash
set -euo pipefail

echo "=== Formatter command in workflow ==="
rg -n 'mise (fmt|format)' .github/workflows/auto-format.yml

echo
echo "=== Repository guidance for mise formatter command ==="
fd -HI 'AGENTS.md|CONTRIBUTING.md|README.md' | xargs -r rg -n 'mise (fmt|format)'

echo
echo "=== Mise task definitions (if present) ==="
fd -HI 'mise.toml|.mise.toml' | xargs -r rg -n '(^\s*fmt\s*=|^\s*format\s*=|tasks\.(fmt|format))'
Suggested patch
-      - run: mise format
+      - run: mise fmt

Based on learnings: Run mise fmt to format code before submission.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-format.yml around lines 31 - 34, The workflow step
calls the wrong mise command: change the run step that invokes "mise format" to
use the repository's canonical formatter entry "mise fmt"; locate the job that
uses jdx/mise-action@v3 and replace the "run: mise format" step with "run: mise
fmt" so the action uses the defined fmt task and avoids failures when only fmt
is provided.

44-50: ⚠️ Potential issue | 🔴 Critical

Configure git user.email before commit.

Lines 47-49 set only user.name; git commit can fail in CI without an email identity.

#!/bin/bash
set -euo pipefail

echo "=== Identity and commit commands in auto-format workflow ==="
rg -n 'git config user\.(name|email)|git commit' .github/workflows/auto-format.yml

echo
echo "=== Existing identity config patterns in other workflows ==="
rg -n 'git config user\.(name|email)' .github/workflows
Suggested patch
       - name: Commit and push formatting changes
         if: steps.check-changes.outputs.has_changes == 'true'
         run: |
           git config user.name "LeshyBot"
+          git config user.email "leshybot@users.noreply.github.com"
           git add .
           git commit -m "[LeshyBot] Apply automatic formatting"
           git push
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-format.yml around lines 44 - 50, The workflow step
"Commit and push formatting changes" sets git user.name but not user.email,
which can cause git commit to fail in CI; update that step to configure both
identity fields by adding a git config user.email line (use a CI-safe address
like "leshybot@example.com" or the provided repo bot email) before git commit so
commits succeed in non-interactive environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/auto-format.yml:
- Around line 31-34: The workflow step calls the wrong mise command: change the
run step that invokes "mise format" to use the repository's canonical formatter
entry "mise fmt"; locate the job that uses jdx/mise-action@v3 and replace the
"run: mise format" step with "run: mise fmt" so the action uses the defined fmt
task and avoids failures when only fmt is provided.
- Around line 44-50: The workflow step "Commit and push formatting changes" sets
git user.name but not user.email, which can cause git commit to fail in CI;
update that step to configure both identity fields by adding a git config
user.email line (use a CI-safe address like "leshybot@example.com" or the
provided repo bot email) before git commit so commits succeed in non-interactive
environments.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0aacc5c and 2acce58.

📒 Files selected for processing (1)
  • .github/workflows/auto-format.yml

@LesnyRumcajs
Copy link
Copy Markdown
Member Author

bailing, doesn't seem to be worth the overhead in the end

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.50%. Comparing base (6dd4826) to head (b983a85).

Additional details and impacted files

see 15 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dd4826...b983a85. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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