Skip to content

Commit

Permalink
Merge pull request #131 from discord-modmail/ci/run-flake8-black-on-p…
Browse files Browse the repository at this point in the history
…re-commit-failure

ci/run flake8 black on pre commit failure
  • Loading branch information
onerandomusername authored Nov 27, 2021
2 parents eec59a3 + 763a243 commit 6ab7918
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ jobs:
# black and flake8 action. As pre-commit does not support user installs,
# we set PIP_USER=0 to not do a user install.
- name: Run pre-commit hooks
id: pre-commit
run: export PIP_USER=0; SKIP="no-commit-to-branch,black,flake8" pre-commit run --all-files

# Run black seperately as we don't want to reformat the files
# just error if something isn't formatted correctly.
- name: Check files with black
id: black
if: always() && (steps.pre-commit.outcome == 'success' || steps.pre-commit.outcome == 'failure')
run: black . --check --diff --color

# Run flake8 and have it format the linting errors in the format of
Expand All @@ -108,6 +111,8 @@ jobs:
# Format used:
# ::error file={filename},line={line},col={col}::{message}
- name: Run flake8
id: flake8
if: always() && (steps.pre-commit.outcome == 'success' || steps.pre-commit.outcome == 'failure')
run: "flake8 \
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::\
[flake8] %(code)s: %(text)s'"
Expand Down

0 comments on commit 6ab7918

Please sign in to comment.