oxlint-suggestion-action
v1.0.1
Published
A template to create custom GitHub Action with TypeScript/JavaScript.
Readme
oxlint-suggestion-action
This GitHub Action runs Oxlint and provides inline feedback on the changes in a Pull Request. Features:
- It posts review comments for Oxlint diagnostics on modified lines.
- It only provides feedback for lines changed in the Pull Request, so pre-existing issues outside the diff do not add noise.
(If you use ESLint you should consider this GitHub Action for similar features.)
Examples
When there is any Oxlint warning or error, this action will leave a comment:
Usage
Set up a GitHub Action like this:
name: Oxlint
on:
push:
branches: [main] # or [master] if that's the name of the main branch
pull_request:
branches: [main] # or [master] if that's the name of the main branch
jobs:
oxlint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
check-latest: true
- name: Install dependencies
run: yarn install # or npm ci if you use npm and have package-lock.json
- uses: CatChen/oxlint-suggestion-action@v1
with:
request-changes: true # optional
fail-check: false # optional
github-token: ${{ secrets.GITHUB_TOKEN }} # optional
directory: './' # optional
targets: '.' # optional
oxlint-bin-path: './node_modules/.bin/oxlint' # optional
config-path: '' # optionalSave the file to .github/workflows/oxlint.yml. It will start working on new Pull Requests.
Options
request-changes
This option determines whether this GitHub Action should request changes if Oxlint does not pass. This option has no effect when the workflow is not triggered by a pull_request event. The default value is true.
fail-check
This option determines whether the GitHub workflow should fail if Oxlint does not pass. The default value is false.
github-token
The default value is ${{ github.token }}, which is the GitHub token generated for this workflow. You can create a different token with a different set of permissions and use it here as well.
directory
The default value is './'. This action runs Oxlint from this directory.
targets
The default value is '.'. For example, it could be 'src' or 'src/**/*.ts' for a typical TypeScript project. You can use glob patterns to match multiple directories, for example '{src,lib}'.
oxlint-bin-path
The default value is './node_modules/.bin/oxlint'. This action uses the Oxlint binary from this path.
config-path
The default value is an empty string. Oxlint's default config discovery is used when this value is empty. If your config file is in a non-default location, set this option.
FAQ
Can I have GitHub suggestions outside of the scope?
No, mostly not. GitHub only allows review comments inside diff hunks (changed lines and a small surrounding context). For consistency, this action only comments on changed lines in the Pull Request.
How can I avoid having annotations in generated code inside a project?
Follow GitHub's documentation and use .gitattributes to mark generated files and directories correctly. GitHub will hide those files in Pull Requests.
