feat: introduce pre-commit framework #2
Workflow file for this run
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 checks | |
on: | |
# Run workflow for PRs. | |
pull_request: | |
# Whenever we have a new commit on main, run the workflow for that. | |
push: | |
branches: [main] | |
jobs: | |
pre-commit: | |
name: Pre-commit checks | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{github.event.pull_request.head.sha}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Run pre-commit checks on PR | |
if: github.event_name == 'pull_request' | |
uses: pre-commit/[email protected] | |
- name: Run pre-commit checks on main | |
if: github.event_name != 'pull_request' | |
uses: pre-commit/[email protected] | |
with: | |
extra_args: --all |