Skip to content

Commit b711d63

Browse files
committed
[.github/workflows] PEP8 Checker action
1 parent a5cc52b commit b711d63

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/pep8.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# By @quentinguidee, licenced under the MIT license.
2+
3+
name: PEP8 check
4+
5+
on: [pull_request_target]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: Setup Python
13+
uses: actions/setup-python@master
14+
with:
15+
version: 3.8
16+
- name: Download pycodestyle
17+
run: |
18+
pip install pycodestyle
19+
- name: Run pycodestyle
20+
id: run_pycodestyle
21+
run: |
22+
echo "::set-output name=pycodestyle::$(pycodestyle .)"
23+
pycodestyle .
24+
continue-on-error: true
25+
- if: steps.run_pycodestyle.outcome == 'failure'
26+
name: Comment (failure)
27+
uses: actions/github-script@v3
28+
env:
29+
OUTPUT: ${{ steps.run_pycodestyle.outputs.pycodestyle }}
30+
with:
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
32+
script: |
33+
const title = "Beep Beep! I found some formatting errors in this PR: \n"
34+
35+
github.issues.createComment({
36+
issue_number: context.issue.number,
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
body: title + ' \n``` \n' + process.env.OUTPUT + ' \n```'
40+
})
41+
- if: steps.run_pycodestyle.outcome == 'success'
42+
name: Comment (success)
43+
uses: actions/github-script@v3
44+
env:
45+
OUTPUT: ${{ steps.run_pycodestyle.outputs.pycodestyle }}
46+
with:
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
script: |
49+
github.issues.createComment({
50+
issue_number: context.issue.number,
51+
owner: context.repo.owner,
52+
repo: context.repo.repo,
53+
body: 'Beep Beep! No formatting errors detected! :partying_face:'
54+
})

0 commit comments

Comments
 (0)