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 pushInputs
Section titled “Inputs”| Input | Description | Default |
|---|---|---|
tool | Run only one tool (for example: ruff, biome, or clippy). | all tools |
auto_commit | When "true", passes --auto-commit. | "false" |
no_commit | When "true", passes --no-commit. | "false" |
github_token | Token exposed to janitor for authenticated operations. | ${{ github.token }} |
skip_install | When "true", skips uv and janitor-sh installation and uses janitor from PATH. | "false" |
Rules and behavior
Section titled “Rules and behavior”auto_commitandno_commitcannot both be"true".- If both are
"false", janitor CLI default behavior is used. - Use
permissions: contents: writewhen janitor may commit changes. - Use
actions/checkoutwithfetch-depth: 0when commit creation is enabled. - Install any external formatter/linter binaries needed by your selected
tool. - Janitor creates commits locally; add a
git pushstep to publish them back to the branch.
Minimal no-commit workflow
Section titled “Minimal no-commit workflow”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"