Movatterモバイル変換


[0]ホーム

URL:


pre-commit.ci lite is an add-on for GitHub Actions which safely auto fixes PRs

pre-commit.ci lite fixing a PR

setup


  1. install theGitHub Application on the relevant repositories

  2. add theGitHub action to your workflow as the last step in your job:

    -uses:pre-commit-ci/[email protected]if:always()

note: the step must have either the defaultname or contain the textpre-commit-ci-lite. the application uses this to find the right workflow.

note: the step must be contained in a job which is either by itself in theworkflow or is the last job to finish in the workflow.

differences with full version


pre-commit.ci lite only provides auto fixing of PRs, but allows theflexibility of using GitHub Actions as a runner.

feature

full

lite

auto fixing PRs

periodic automatic hook updates

speed

arbitrary setup (language: system, etc.)

other code modification tools

example usingpre-commit/action


technicallypre-commit.ci lite works for any code modification, though it wasbuilt withpre-commit in mind. here is an example workflow:

on:pull_request:push:branches:[main,test-me-*]jobs:main:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v3-uses:actions/setup-python@v4with:python-version:3.x-uses:pre-commit/[email protected]-uses:pre-commit-ci/[email protected]if:always()

pre-commit ci will skip pushes made by bots to prevent infinite loops.to trigger an autofix in that scenario, set up alabeled trigger:

--- a/.github/workflows/pre-commit.yml+++ b/.github/workflows/pre-commit.yml@@ -1,13 +1,19 @@on:  pull_request:+    types: [labeled, opened, reopened, synchronize]  push:    branches: [main, test-me-*]jobs:  main:+    if: "github.event.action != 'labeled' || github.event.label.name == 'pre-commit ci run'"    runs-on: ubuntu-latest    steps:    - uses: actions/checkout@v3+    - run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run'+      if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run'+      env:+        GH_TOKEN: ${{ github.token }}    - uses: actions/setup-python@v4      with:        python-version: 3.x

pricing


pre-commit.ci will always befree for open source repositories.

for private and organization repository support see theGitHub Marketplace.

for single-tenant or larger installations, contact[email protected].


[8]ページ先頭

©2009-2025 Movatter.jp