diff --git a/README.md b/README.md index 968c73a..e81b376 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ AI-powered formatting, labeling, and PR summaries for Python, Swift, and Markdow - **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter - **Python Docstrings:** Google-style formatting enforced with Ultralytics Python docstring formatter (optional) +- **JavaScript/TypeScript:** Formatted with [Biome](https://biomejs.dev/), an extremely fast formatter for JS, TS, JSX, TSX, and JSON (optional, auto-detected via `biome.json`) - **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance - **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) _(requires `macos-latest` runner)_ - **Spell Check:** Common misspellings caught using [codespell](https://github.com/codespell-project/codespell) @@ -82,6 +83,7 @@ jobs: labels: true # Auto-label issues/PRs using AI python: true # Format Python with Ruff python_docstrings: false # Format Python docstrings (default: false) + biome: true # Format JS/TS with Biome (auto-detected via biome.json) prettier: true # Format YAML, JSON, Markdown, CSS swift: false # Format Swift (requires macos-latest) dart: false # Format Dart/Flutter diff --git a/action.yml b/action.yml index a1405e3..d123a9f 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,10 @@ inputs: description: "Run Markdown formatting (deprecated in favor of prettier)" required: false default: "false" + biome: + description: "Run Biome formatting" + required: false + default: "false" prettier: description: "Run Prettier formatting for JavaScript, JSX, Angular, Vue, Flow, TypeScript, CSS, HTML, JSON, GraphQL, Markdown, YAML" required: false @@ -171,6 +175,19 @@ runs: shell: bash continue-on-error: true + # Biome (JavaScript, TypeScript, JSON, JSX, TSX) ------------------------------------------------------------------ + - name: Run Biome + if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && inputs.biome == 'true' && (github.event.action == 'opened' || github.event.action == 'synchronize') + run: | + if [ -f "biome.json" ] || [ -f "biome.jsonc" ]; then + npm install --global @biomejs/biome@latest + npx biome check --write --unsafe --line-width 120 . + else + echo "⚠️ No biome.json or biome.jsonc found, skipping Biome formatting" + fi + shell: bash + continue-on-error: true + # Prettier (JavaScript, JSX, Angular, Vue, Flow, TypeScript, CSS, HTML, JSON, GraphQL, Markdown, YAML) ------------- - name: Run Prettier if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && (inputs.prettier == 'true' || inputs.markdown == 'true') && (github.event.action == 'opened' || github.event.action == 'synchronize')