Skip to content

Commit

Permalink
Add pre-commit workflow and config
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed Oct 31, 2024
1 parent 2ad3af7 commit 209f6d4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/create-public-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
pull_request:
push:
branches: [main, master]

name: pre-commit

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install pre-commit
shell: bash
run: pip install pre-commit

- name: Cache pre-commit environment
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
shell: bash
run: pre-commit run --show-diff-on-failure --color=always --all-files
3 changes: 2 additions & 1 deletion .github/workflows/update-data-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
hooks:
- id: yamllint

0 comments on commit 209f6d4

Please sign in to comment.