Last active
May 8, 2024 20:22
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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