Skip to content

Commit 88a7e74

Browse files
committed
Update workflows with quentinguidee/pep8-actions@v1
1 parent b9d50b5 commit 88a7e74

File tree

1 file changed

+18
-34
lines changed

1 file changed

+18
-34
lines changed

.github/workflows/pep8.yml

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# By @quentinguidee, licenced under the MIT license.
2-
31
name: PEP8 check
42

53
on: [pull_request_target]
@@ -9,46 +7,32 @@ jobs:
97
runs-on: ubuntu-latest
108
steps:
119
- uses: actions/checkout@master
12-
- name: Setup Python
13-
uses: actions/setup-python@master
1410
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 }}
11+
ref: ${{ github.event.pull_request.head.sha }}
12+
- name: 'Run PEP8'
13+
uses: quentinguidee/pep8-action@v1
14+
id: run_pep8
3015
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)
16+
arguments: '--max-line-length=79'
17+
continue-on-error: true
18+
- name: 'Comment'
4319
uses: actions/github-script@v3
4420
env:
45-
OUTPUT: ${{ steps.run_pycodestyle.outputs.pycodestyle }}
21+
EXIT_CODE: ${{ steps.run_pep8.outputs.exit-code }}
22+
OUTPUT: ${{ steps.run_pep8.outputs.output }}
4623
with:
4724
github-token: ${{ secrets.GITHUB_TOKEN }}
4825
script: |
26+
var message;
27+
if (process.env.EXIT_CODE === '0') {
28+
message = 'Beep Beep! No formatting errors detected! :partying_face:'
29+
} else {
30+
message = 'Beep Beep! I found some formatting errors in this PR: \n'
31+
message += ' \n``` \n' + process.env.OUTPUT + ' \n```'
32+
}
4933
github.issues.createComment({
5034
issue_number: context.issue.number,
5135
owner: context.repo.owner,
5236
repo: context.repo.repo,
53-
body: 'Beep Beep! No formatting errors detected! :partying_face:'
54-
})
37+
body: message,
38+
})

0 commit comments

Comments
 (0)