generated from evmckinney9/python-template
-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (32 loc) · 1.01 KB
/
format-check.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
36
37
38
name: Format Check
on:
push:
branches:
- main # Runs on pushes to main branch
pull_request:
branches:
- main # Runs on PRs to main branch
jobs:
run-format-check:
if: github.repository != 'evmckinney9/python-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check if template_flag.yml is gone
id: check-template
if: ${{ hashFiles('.github/template_flag.yml') == '' }}
run: |
echo "format_continue=true" >> $GITHUB_ENV
- name: Set up Python
if: env.format_continue == 'true'
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install pre-commit packages
if: env.format_continue == 'true'
run: pip install .[format] --quiet
- name: Run pre-commit
if: env.format_continue == 'true'
run: pre-commit run --all-files