Fix-it Felix is a GitHub Action that automatically fixes minor code quality issues (linting, formatting) in pull requests. It's designed to be configurable, safe, and work across multiple repositories in your organization.
- π§ Multiple Fixers: Support for ESLint, Prettier, and Markdownlint
- π¨ Custom Commands: Use your own npm scripts or custom commands
- βοΈ Configurable: Per-repository configuration via
.felixrc.json - π€ Auto-commit: Automatically commits fixes to PR branches
- π‘οΈ Safety First: Built-in safeguards against infinite loops
- π Dry-run Mode: Preview changes without committing
- π« Skip Control: Label-based opt-out mechanism
- π Draft PR Control: Optionally skip draft PRs
- π΄ Fork Friendly: Handles forked PRs gracefully
Create .github/workflows/fix-it-felix.yml in your repository:
name: Fix-it Felix
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
autofix:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
# β οΈ REQUIRED: Install dependencies before running Felix
# This ensures your project's exact tool versions and configs are used
- name: Install dependencies
run: npm ci
- name: Run Fix-it Felix
uses: launchdarkly-labs/fix-it-felix@v1
with:
fixers: 'eslint,prettier'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}| Input | Description | Required | Default |
|---|---|---|---|
fixers |
Comma-separated list of fixers to run | No | eslint,prettier |
commit_message |
Commit message for auto-fix commits | No | π€ Fix-it Felix: Auto-fixed code quality issues |
config_path |
Path to Felix configuration file | No | .felixrc.json |
dry_run |
Run in dry-run mode (comment instead of commit) | No | false |
skip_label |
PR label that skips Felix processing | No | skip-felix |
skip_draft_prs |
Skip processing draft pull requests | No | false |
allowed_bots |
Comma-separated list of bot names Felix should run against | No | `` |
paths |
Comma-separated list of paths to run fixers on | No | . |
| Output | Description |
|---|---|
fixes_applied |
Whether any fixes were applied (true/false) |
changed_files |
Comma-separated list of files that were modified |
- Default Command:
npx eslint --fix . - Extensions:
.js,.jsx,.ts,.tsx,.vue - Config: Respects existing ESLint configuration
- Custom Commands: Override with your own npm scripts or commands
- Default Command:
npx prettier --write - Extensions:
.js,.jsx,.ts,.tsx,.json,.css,.scss,.md,.yml,.yaml - Config: Respects existing Prettier configuration
- Custom Commands: Override with your own npm scripts or commands
- Default Command:
npx markdownlint-cli2 --fix - Extensions:
.md,.markdown - Config: Respects existing Markdownlint configuration
- Custom Commands: Override with your own npm scripts or commands
Control Felix through action inputs:
- name: Run Fix-it Felix
uses: launchdarkly-labs/fix-it-felix@v1
with:
fixers: 'eslint,prettier' # Which tools to run
paths: 'src,docs' # Which directories to process
dry_run: false # Set to true to preview changesFor advanced settings, create a .felixrc.json file:
{
"fixers": ["eslint", "prettier"],
"paths": ["src", "docs"],
"ignore": ["node_modules/**", "dist/**"],
"eslint": {
"configFile": ".eslintrc.js",
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"prettier": {
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json", ".md"]
}
}Use your own npm scripts instead of built-in commands:
{
"eslint": {
"command": ["npm", "run", "lint:fix"],
"appendPaths": true // Append file paths for performance
},
"prettier": {
"command": ["npm", "run", "format"],
"appendPaths": false // Run script as-is
}
}π Full Configuration Guide β
- Configuration Guide - Complete configuration reference
- Examples - Workflow examples and sample configs
- Detects commits made by Felix or other bots
- Skips processing if last commit was automated
- Prevents endless fix-commit cycles
- Exception: Bots listed in
allowed_botswill bypass this protection
- Automatically detects forked PRs
- Skips processing (cannot commit to forks with default token)
- Logs appropriate messages
By default, Felix processes draft PRs just like regular PRs. You can configure Felix to skip draft PRs entirely:
- name: Run Fix-it Felix
uses: launchdarkly/fix-it-felix-action@v1
with:
skip_draft_prs: trueThis is useful when you want to:
- Prevent commits on work-in-progress PRs
- Let developers refine their changes before auto-fixing
- Reduce action runs during development
- Label-based: Add
skip-felixlabel to PR - Draft PRs: Set
skip_draft_prs: trueto skip draft PRs - Configuration: Set
fixers: []in.felixrc.json - Event-based: Only runs on specific PR events
Test Felix without committing changes:
- name: Run Fix-it Felix (Dry Run)
uses: launchdarkly-labs/fix-it-felix@v1
with:
fixers: 'eslint,prettier'
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}In dry-run mode, Felix will:
- Run all configured fixers
- Generate a PR comment with proposed changes
- Not commit or push any changes
See the examples/ directory for workflow examples:
- Basic usage - Simple setup
- Advanced usage - Configuration with dry-run
- Configuration file - Example
.felixrc.json
- Node.js 20+
- npm
npm installnpm run buildnpm testnpm run package- Create a feature branch
- Make your changes
- Add tests if applicable
- Run
npm run packageto update the distribution - Submit a pull request
- Support for more fixers (stylelint, gofmt, black, etc.)
-
Custom fixer supportβ Completed - Use custom commands - Monorepo support
- Slack/Discord notifications
- Performance optimizations
Made with β€οΈ by LaunchDarkly
