-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (34 loc) · 1.04 KB
/
format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Check formatting
on:
workfow_call:
inputs:
python_v:
description: "Python version needed to run the code, eg. 3.10.6"
default: 3.10.6
required: false
type: string
jobs:
format:
name: Check formatting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Python ${{ inputs.python_v }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_v }}
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit install
- name: Run pre-commit (all files)
run: |
if test -f ".pre-commit-config.yaml"
then
pre-commit run --all-files --show-diff-on-failure
else
echo "::warning::No pre-commit config available"
fi