Skip to content
This repository was archived by the owner on Oct 29, 2022. It is now read-only.

Commit c258b7f

Browse files
committed
Don't fail autoformat jobs
1 parent 4820490 commit c258b7f

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

.github/workflows/lint.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Lint
22
on:
3-
push:
4-
branches:
5-
- main
63
pull_request:
74

85
jobs:
9-
lint-with-pre-commit:
6+
autoformat:
107
runs-on: ubuntu-latest
118
steps:
129
- uses: actions/checkout@v3
@@ -20,13 +17,28 @@ jobs:
2017
- name: Install pre-commit
2118
run: pip install pre-commit
2219

23-
- name: Run pre-commit hooks
24-
id: pre-commit
25-
run: pre-commit run --all-files
20+
- name: Run autoformatters
21+
run: pre-commit run autoformat --all-files || true
2622

2723
- name: Commit autoformatting changes back to pull request
28-
if: always() && (steps.pre-commit.outcome == 'failure') && (github.event_name == 'pull_request')
2924
uses: devops-infra/[email protected]
3025
with:
3126
commit_message: "Autoformat via GitHub Actions"
3227
github_token: ${{ secrets.ADD_TO_PROJECT_PAT }}
28+
29+
lint:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- uses: actions/setup-python@v4
35+
with:
36+
python-version: '3.10'
37+
38+
- name: Install pre-commit
39+
run: pip install pre-commit
40+
41+
- name: Run linters
42+
env:
43+
SKIP: autoformat
44+
run: pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,27 @@ repos:
55
rev: v4.3.0
66
hooks:
77
- id: trailing-whitespace
8+
alias: autoformat
89
- id: end-of-file-fixer
10+
alias: autoformat
911
- id: check-yaml
1012
- id: requirements-txt-fixer
13+
alias: autoformat
1114
files: requirements.in
1215

1316
- repo: https://github.com/psf/black
1417
rev: 22.8.0
1518
hooks:
1619
- id: black
20+
alias: autoformat
1721
name: Format Python
1822
language_version: python3.10
1923

2024
- repo: https://github.com/pycqa/isort
2125
rev: 5.10.1
2226
hooks:
2327
- id: isort
28+
alias: autoformat
2429
name: Format Python imports
2530
args:
2631
- --profile=black
@@ -29,6 +34,7 @@ repos:
2934
rev: 6.8.0
3035
hooks:
3136
- id: pip-compile
37+
alias: autoformat
3238
name: Compile Python requirements
3339

3440

0 commit comments

Comments
 (0)