Skip to content

GitHub Action

Use the official action:

name: janitor
on:
pull_request: {}
permissions:
contents: write
jobs:
janitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install ruff
run: python -m pip install ruff
- name: Run janitor
uses: janitor-sh/action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tool: "ruff"
- name: Push janitor commit
run: git push
InputDescriptionDefault
toolRun only one tool (for example: ruff, biome, or clippy).all tools
auto_commitWhen "true", passes --auto-commit."false"
no_commitWhen "true", passes --no-commit."false"
github_tokenToken exposed to janitor for authenticated operations.${{ github.token }}
skip_installWhen "true", skips uv and janitor-sh installation and uses janitor from PATH."false"
  • auto_commit and no_commit cannot both be "true".
  • If both are "false", janitor CLI default behavior is used.
  • Use permissions: contents: write when janitor may commit changes.
  • Use actions/checkout with fetch-depth: 0 when commit creation is enabled.
  • Install any external formatter/linter binaries needed by your selected tool.
  • Janitor creates commits locally; add a git push step to publish them back to the branch.
name: janitor-check
on:
pull_request: {}
permissions:
contents: write
jobs:
janitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: janitor-sh/action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
no_commit: "true"