Skip to content

Instantly share code, notes, and snippets.

@jsignell
Last active May 8, 2024 20:22
Show Gist options
  • Save jsignell/f1d22b56183b74bd58ca82557d4535ed to your computer and use it in GitHub Desktop.
Save jsignell/f1d22b56183b74bd58ca82557d4535ed to your computer and use it in GitHub Desktop.
Github Action to run pre-commit on files changed between target branch and base branch
name: pre-commit-ci
on:
pull_request:
branches:
- main
jobs:
pre-commit-ci:
name: Lint changed backend files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git fetch --depth=1 origin +${{github.base_ref}}
- uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: pre-commit/action@v2.0.0
with:
extra_args: --from-ref origin/${{github.base_ref}} --to-ref HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment