Skip to content

ci: add autofix workflow #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged

ci: add autofix workflow #419

merged 1 commit into from
Mar 28, 2025

Conversation

JounQin
Copy link
Collaborator

@JounQin JounQin commented Mar 28, 2025

Summary by CodeRabbit

  • New Features
    • Introduced an automated process that formats code consistently when new changes are submitted.
    • Added a dedicated command to run code formatting, ensuring a uniform code style across the project.

Copy link

changeset-bot bot commented Mar 28, 2025

⚠️ No Changeset found

Latest commit: 23d872b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JounQin JounQin requested a review from Copilot March 28, 2025 17:52
Copy link

coderabbitai bot commented Mar 28, 2025

Walkthrough

The changes introduce a new GitHub Actions workflow (autofix.yml) that triggers on pull requests and includes steps for checking out the repository, setting up a Node.js environment, caching dependencies, installing packages, formatting code, and running an autofix action. Additionally, a new formatting script has been added to package.json to enforce consistent code style using Prettier.

Changes

File(s) Change Summary
.github/workflows/autofix.yml Added a new GitHub Actions workflow which triggers on pull requests, includes steps for checkout, Node.js setup, dependency installation, code formatting, and running an autofix action.
package.json Added a new "format": "prettier --write ." script to format the codebase and ensure consistent styling.

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request
    participant GH as GitHub Actions
    participant Runner as Ubuntu Runner

    PR->>GH: Open/Synchronize Pull Request
    GH->>Runner: Start `autofix` job
    Runner->>Runner: Checkout repository
    Runner->>Runner: Setup Node.js with latest LTS
    Runner->>Runner: Install dependencies (immutable)
    Runner->>Runner: Format code using Yarn
    Runner->>Runner: Execute autofix action (continue on errors)
Loading

Poem

In the land of code I hop,
New workflows make my heart go pop.
With checkout, Node, and formatting flair,
Bugs get nibbled with tender care.
Hopping through PRs, my changes delight,
A rabbit's cheer in the coder's light!
🐇💻


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@Copilot 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 pull request adds an autofix workflow designed to automatically apply code formatting and fixes when a pull request is opened or synchronized.

  • Implements the autofix.ci workflow with clear steps for checking out the repository, setting up Node.js, installing dependencies, formatting code, and applying autofix.
  • Utilizes concurrency to cancel in-progress runs, ensuring only the latest changes are processed.
Files not reviewed (1)
  • package.json: Language not supported

Copy link

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

pkg-pr-new bot commented Mar 28, 2025

Open in Stackblitz

npm i https://pkg.pr.new/import-js/eslint-import-resolver-typescript@419

commit: 23d872b

Copy link
Contributor

size-limit report 📦

Path Size
lib/index.js 1.35 KB (0%)

@JounQin
Copy link
Collaborator Author

JounQin commented Mar 28, 2025

@coderabbitai configuration

Copy link

coderabbitai bot commented Mar 28, 2025

CodeRabbit configuration
language: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
auto_resolve_threads: true
reviews:
  profile: chill
  request_changes_workflow: false
  high_level_summary: true
  high_level_summary_placeholder: '@coderabbitai summary'
  high_level_summary_in_walkthrough: false
  auto_title_placeholder: '@coderabbitai'
  auto_title_instructions: ''
  review_status: true
  commit_status: true
  fail_commit_status: false
  collapse_walkthrough: false
  changed_files_summary: true
  sequence_diagrams: true
  assess_linked_issues: true
  related_issues: true
  related_prs: true
  suggested_labels: true
  auto_apply_labels: false
  suggested_reviewers: true
  auto_assign_reviewers: false
  poem: true
  labeling_instructions: []
  path_filters: []
  path_instructions: []
  abort_on_close: true
  auto_review:
    enabled: true
    auto_incremental_review: true
    ignore_title_keywords: []
    labels: []
    drafts: false
    base_branches: []
  finishing_touches:
    docstrings:
      enabled: true
  tools:
    ast-grep:
      rule_dirs: []
      util_dirs: []
      essential_rules: true
      packages: []
    shellcheck:
      enabled: true
    ruff:
      enabled: true
    markdownlint:
      enabled: true
    github-checks:
      enabled: true
      timeout_ms: 90000
    languagetool:
      enabled: true
      enabled_rules: []
      disabled_rules: []
      enabled_categories: []
      disabled_categories: []
      enabled_only: false
      level: default
    biome:
      enabled: true
    hadolint:
      enabled: true
    swiftlint:
      enabled: true
    phpstan:
      enabled: true
      level: default
    golangci-lint:
      enabled: true
    yamllint:
      enabled: true
    gitleaks:
      enabled: true
    checkov:
      enabled: true
    detekt:
      enabled: true
    eslint:
      enabled: true
    rubocop:
      enabled: true
    buf:
      enabled: true
    regal:
      enabled: true
    actionlint:
      enabled: true
    pmd:
      enabled: true
    cppcheck:
      enabled: true
    semgrep:
      enabled: true
    circleci:
      enabled: true
    sqlfluff:
      enabled: true
chat:
  auto_reply: true
  create_issues: true
  integrations:
    jira:
      usage: auto
    linear:
      usage: auto
knowledge_base:
  opt_out: false
  web_search:
    enabled: true
  learnings:
    scope: auto
  issues:
    scope: auto
  jira:
    usage: auto
    project_keys: []
  linear:
    usage: auto
    team_keys: []
  pull_requests:
    scope: auto
code_generation:
  docstrings:
    language: en-US

Copy link

@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: 0

🧹 Nitpick comments (2)
.github/workflows/autofix.yml (1)

3-8: Pull Request Trigger Configuration is Appropriate
The workflow is set to trigger on pull requests with the “opened” and “synchronize” event types. This is appropriate for ensuring that code changes are automatically formatted when new commits are pushed to an open PR. Consider reviewing if the “reopened” event should also trigger this workflow for consistency, though it may be intentional as-is.

package.json (1)

57-57: Addition of the "format" Script is Correct
The new "format": "prettier --write ." script is correctly added in the scripts section. This enables consistent code formatting when invoked (e.g., via the autofix workflow). Consider ensuring that a corresponding Prettier configuration file (such as .prettierrc) is present to maintain desired code style rules.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3f678b and 23d872b.

📒 Files selected for processing (2)
  • .github/workflows/autofix.yml (1 hunks)
  • package.json (1 hunks)
🔇 Additional comments (7)
.github/workflows/autofix.yml (7)

1-1: Workflow Name is Clear and Compliant
The workflow name “autofix.ci” and its accompanying comment clearly explain that the name is required for security reasons. This is concise and clear.


9-12: Concurrency Group Configuration is Well Defined
The concurrency settings using a group based on the workflow name and branch reference (i.e. ${{ github.workflow }}-${{ github.ref }}) help prevent redundant runs by canceling in-progress workflows. This configuration is both concise and effective.


17-18: Repository Checkout Step is Correct
The use of actions/checkout@v4 to check out the repository is correct and follows best practices.


20-24: Node.js Environment Setup is Configured Properly
The step uses actions/setup-node@v4 with the latest LTS node version and caches using Yarn. This is a robust configuration that ensures dependencies are managed efficiently.


26-27: Dependencies Installation Step is Effective
Running yarn --immutable ensures that the installed dependencies strictly match the lockfile, which is essential for a reproducible environment.


29-30: Code Formatting Step Aligns with Project Standards
The step executing yarn format will run Prettier as configured in the project. This integration reinforces consistent code style across the repository.


32-35: Autofix Action Integration is Straightforward
The final step applies the autofix-ci action with fail-fast: false, which allows for gathering all formatting issues without halting on the first error. Ensure that the behavior of this action is well documented so that maintainers know how to address autofix feedback.

@JounQin JounQin merged commit b31554f into master Mar 28, 2025
35 checks passed
@JounQin JounQin deleted the ci/autofix branch March 28, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant