[!WARNING]
This repository is no longer actively maintained. It is strongly suggested that you use the officially-supported Ruff action from Astral.
A GitHub Action for Ruff
Ruff can now be used as a GitHub Action.
This action is commonly used as a pass/fail test to ensure your repository stays clean, abiding the Rules specified in your configuration. Though it runs ruff
, the action can do anything ruff
can (ex, fix).
This action is known to support all GitHub-hosted runner OSes. It likely can run on self-hosted runners, but might need specific dependencies. Only published versions of Ruff are supported (i.e. whatever is available on PyPI).
Create a file (ex: .github/workflows/ruff.yml
) inside your repository with:
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
The Ruff action can be customized via optional configuration parameters passed to Ruff (using with:
):
check
.See Configuring Ruff for details
- uses: chartboost/ruff-action@v1
with:
version: 0.2.2
- uses: chartboost/ruff-action@v1
with:
src: './src'
ruff format
- uses: chartboost/ruff-action@v1
with:
args: 'format --check'
- uses: chartboost/ruff-action@v1
with:
changed-files: 'true'