Skip to content

Commit 1388e15

Browse files
authored
Create pre-commit.yml
1 parent 20430aa commit 1388e15

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run pre-commit
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
commands:
7+
required: false
8+
type: string
9+
default: ""
10+
description: run additional commands for preparing the environment
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
id: python-setup
19+
with:
20+
python-version: '3.x'
21+
- name: Run commands
22+
if: inputs.commands
23+
run: ${{ inputs.commands }}
24+
- name: Cache pre-commit environments
25+
uses: actions/cache@v4
26+
with:
27+
path: '~/.cache/pre-commit'
28+
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
29+
- run: pipx run pre-commit run --show-diff-on-failure --color=always --all-files

0 commit comments

Comments
 (0)