Skip to content

chore(ci): add autofix.ci workflow for automatic code fixes#840

Merged
yamadashy merged 2 commits intomainfrom
chore/autofix-ci
Sep 14, 2025
Merged

chore(ci): add autofix.ci workflow for automatic code fixes#840
yamadashy merged 2 commits intomainfrom
chore/autofix-ci

Conversation

@yamadashy
Copy link
Owner

Add autofix.ci GitHub workflow to automatically fix linting and formatting issues in pull requests.

This workflow integrates with the existing project linting tools to provide automatic code fixes:

  • Biome: Code formatting and linting fixes
  • Oxlint: Additional linting fixes
  • Website components: Fixes for client and server linting
  • Browser extension: Linting fixes for browser extension code

The workflow runs on pull requests and pushes to the main branch, helping maintain code quality standards automatically by fixing common issues that can be resolved programmatically.

Checklist

  • Run npm run test
  • Run npm run lint

Add autofix.ci GitHub workflow to automatically fix linting and formatting issues in pull requests. This includes:

- Biome code formatting and linting fixes
- Oxlint additional linting fixes
- Website client/server linting fixes
- Browser extension linting fixes

The workflow runs on pull requests and pushes to main branch, helping maintain code quality standards automatically.
Copilot AI review requested due to automatic review settings September 14, 2025 15:10
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 14, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Introduces a new GitHub Actions workflow (.github/workflows/autofix.yml) that runs on pull_request events and pushes to main. It installs Node.js and npm dependencies, runs multiple lint/fix tasks across subpackages with continue-on-error, and then executes the autofix-ci/action.

Changes

Cohort / File(s) Change Summary
CI Workflow: Autofix
\.github/workflows/autofix.yml
Added a workflow named "autofix.ci" triggered on pull_request and push to main; sets up Node via version file with npm caching; runs npm ci; executes biome and oxlint plus lint/fix tasks in website/client, website/server, and browser (continue-on-error); runs autofix-ci/action.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Developer
    participant GH as GitHub
    participant Runner as Actions Runner
    participant Repo as Repo

    Dev->>GH: Open PR / Push to main
    GH-->>Runner: Trigger workflow "autofix.ci"

    rect rgb(240,248,255)
    note right of Runner: Job on ubuntu-latest
    Runner->>Repo: actions/checkout
    Runner->>Runner: setup-node (node-version-file, npm cache)
    Runner->>Runner: npm ci (install deps)
    Runner->>Runner: biome lint/fix (continue-on-error)
    Runner->>Runner: oxlint (continue-on-error)
    Runner->>Runner: npm run lint/fix (website/client) (continue-on-error)
    Runner->>Runner: npm run lint/fix (website/server) (continue-on-error)
    Runner->>Runner: npm run lint/fix (browser) (continue-on-error)
    Runner->>Repo: autofix-ci/action (commit fixes)
    end

    Repo-->>Dev: Pushes fixes to PR (if any)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately summarizes the primary change: adding an autofix CI workflow to perform automatic code fixes, and it uses a conventional commit prefix (chore(ci)) making intent and scope clear to reviewers. It maps directly to the added .github/workflows/autofix.yml workflow and is concise enough for history scanning.
Description Check ✅ Passed The PR description includes a clear summary of the workflow's purpose, lists the integrated tools (Biome, Oxlint, website client/server, browser), and specifies the workflow triggers (pull requests and pushes to main). It also contains the repository's required checklist with both "npm run test" and "npm run lint" marked complete, satisfying the template's required items. The detail provided is sufficient for reviewers to understand the change and its intent.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/autofix-ci

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a GitHub Actions workflow for autofix.ci that automatically fixes linting and formatting issues in pull requests. The workflow integrates with the project's existing linting tools to provide programmatic code fixes.

Key changes:

  • Adds autofix.ci workflow that runs on pull requests and main branch pushes
  • Integrates with Biome, Oxlint, and component-specific linting tools
  • Uses continue-on-error strategy to handle linting failures gracefully

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 14, 2025

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 56a5561
Status: ✅  Deploy successful!
Preview URL: https://f9322bd7.repomix.pages.dev
Branch Preview URL: https://chore-autofix-ci.repomix.pages.dev

View logs

@codecov
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.27%. Comparing base (0d0290c) to head (56a5561).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #840   +/-   ##
=======================================
  Coverage   87.27%   87.27%           
=======================================
  Files         113      113           
  Lines        6839     6839           
  Branches     1408     1408           
=======================================
  Hits         5969     5969           
  Misses        870      870           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Update autofix.yml workflow to use pinned action versions:
- Pin actions/checkout@v5 with commit hash
- Pin actions/setup-node@v4 with commit hash
- Pin autofix-ci/action@v1.3.2 with commit hash
- Minor formatting improvements

This improves security by using specific commit hashes instead of mutable tags.
Copy link
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: 1

♻️ Duplicate comments (1)
.github/workflows/autofix.yml (1)

8-10: Autofix will not be able to push without write perms; scope them at the job level.

Top-level is least‑privilege (contents: read), but the job that runs autofix needs write to commit fixes back to PR branches.

Apply at the job level to avoid widening perms repo‑wide:

 jobs:
   autofix:
     runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
     steps:

Also applies to: 11-14

🧹 Nitpick comments (8)
.github/workflows/autofix.yml (8)

55-55: Prevent loops and only run the push-back step on PRs (skip bot re-triggers).

Without a guard, pushes from autofix-ci could retrigger this workflow. Gate the final step.

-      - uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 # ratchet:autofix-ci/action@v1.3.2
+      - if: ${{ github.event_name == 'pull_request' && github.actor != 'autofix-ci[bot]' }}
+        uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 # ratchet:autofix-ci/action@v1.3.2

23-24: Guard root npm ci in case the repo root has no package-lock.json.

Prevents hard failures in mono-repos that install per package.

-      - name: Install dependencies
-        run: npm ci
+      - name: Install dependencies (root)
+        if: ${{ hashFiles('package-lock.json') != '' }}
+        run: npm ci

34-39: Guard website/client install; don’t fail if the package doesn’t exist.

Keeps the workflow resilient across optional packages.

       - name: Fix website client linting
         working-directory: website/client
+        if: ${{ hashFiles('website/client/package-lock.json') != '' }}
         run: |
           npm ci
           npm run lint
         continue-on-error: true

41-47: Guard website/server install similarly.

       - name: Fix website server linting
         working-directory: website/server
+        if: ${{ hashFiles('website/server/package-lock.json') != '' }}
         run: |
           npm ci
           npm run lint
         continue-on-error: true

48-54: Guard browser extension install similarly.

       - name: Fix browser extension linting
         working-directory: browser
+        if: ${{ hashFiles('browser/package-lock.json') != '' }}
         run: |
           npm ci
           npm run lint
         continue-on-error: true

15-15: Harden checkout for bot-based commits.

Use full history and avoid persisting default credentials so pushes (if any) come from the bot/token you intend.

-      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # ratchet:actions/checkout@v5
+      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # ratchet:actions/checkout@v5
+        with:
+          fetch-depth: 0
+          persist-credentials: false

11-14: Add concurrency and a job timeout to avoid overlapping runs.

Prevents racey double-pushes and hung jobs.

   autofix:
     runs-on: ubuntu-latest
+    timeout-minutes: 20
+    concurrency:
+      group: ${{ github.workflow }}-${{ github.ref }}
+      cancel-in-progress: true

1-6: Consider removing the push-to-main trigger or split it into a non-fixing job.

Running autofix on pushes to main is usually unnecessary and risks loops. If you need lint-on-main, split to a separate workflow without the autofix push-back step.

Option A — restrict this workflow to PRs only:

 on:
   pull_request:
-  push:
-    branches: ["main"]

Option B — keep push but skip the autofix step (already suggested with if: on the final step).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d0290c and 56a5561.

📒 Files selected for processing (1)
  • .github/workflows/autofix.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-02T17:45:31.561Z
Learnt from: chenrui333
PR: yamadashy/repomix#151
File: .github/workflows/release.yml:13-13
Timestamp: 2024-11-02T17:45:31.561Z
Learning: For `.github/workflows/release.yml`, the project prefers to use `master` for GitHub Actions instead of pinning specific versions.

Applied to files:

  • .github/workflows/autofix.yml
🔇 Additional comments (3)
.github/workflows/autofix.yml (3)

55-55: Nice: pinned to a commit SHA with a ratchet tag.

The inline ratchet comment documents the version (v1.3.2). No further action.


15-55: Note on action pinning vs. floating refs.

A past preference in this repo favored floating refs like master in release.yml. Here you’re pinning to SHAs with ratchet tags, which is the more secure default. Confirm the current repo standard so we keep it consistent across workflows.

If needed, I can open a follow-up PR to align the other workflows.


17-22: No change required — actions/setup-node@v4 supports .tool-versions
The action's node-version-file accepts an asdf .tool-versions file (format example: nodejs 16.14.0; comments and multiple versions allowed). Ensure .tool-versions contains explicit/full versions; use node-version: "lts/*" if you want an explicit fallback.

@yamadashy yamadashy merged commit a543f88 into main Sep 14, 2025
50 checks passed
@yamadashy yamadashy deleted the chore/autofix-ci branch September 14, 2025 15:24
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