From 88a7e74882ed681680d4196a30d20e8374ff05b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Guid=C3=A9e?= Date: Mon, 29 Mar 2021 21:18:46 +0200 Subject: [PATCH 1/2] Update workflows with quentinguidee/pep8-actions@v1 --- .github/workflows/pep8.yml | 52 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 81acc69..b8b352e 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -1,5 +1,3 @@ -# By @quentinguidee, licenced under the MIT license. - name: PEP8 check on: [pull_request_target] @@ -9,46 +7,32 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: Setup Python - uses: actions/setup-python@master with: - version: 3.8 - - name: Download pycodestyle - run: | - pip install pycodestyle - - name: Run pycodestyle - id: run_pycodestyle - run: | - echo "::set-output name=pycodestyle::$(pycodestyle .)" - pycodestyle . - continue-on-error: true - - if: steps.run_pycodestyle.outcome == 'failure' - name: Comment (failure) - uses: actions/github-script@v3 - env: - OUTPUT: ${{ steps.run_pycodestyle.outputs.pycodestyle }} + ref: ${{ github.event.pull_request.head.sha }} + - name: 'Run PEP8' + uses: quentinguidee/pep8-action@v1 + id: run_pep8 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const title = "Beep Beep! I found some formatting errors in this PR: \n" - - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: title + ' \n``` \n' + process.env.OUTPUT + ' \n```' - }) - - if: steps.run_pycodestyle.outcome == 'success' - name: Comment (success) + arguments: '--max-line-length=79' + continue-on-error: true + - name: 'Comment' uses: actions/github-script@v3 env: - OUTPUT: ${{ steps.run_pycodestyle.outputs.pycodestyle }} + EXIT_CODE: ${{ steps.run_pep8.outputs.exit-code }} + OUTPUT: ${{ steps.run_pep8.outputs.output }} with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | + var message; + if (process.env.EXIT_CODE === '0') { + message = 'Beep Beep! No formatting errors detected! :partying_face:' + } else { + message = 'Beep Beep! I found some formatting errors in this PR: \n' + message += ' \n``` \n' + process.env.OUTPUT + ' \n```' + } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'Beep Beep! No formatting errors detected! :partying_face:' - }) + body: message, + }) \ No newline at end of file From e757b4358744706d826283d3240406370a27abc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Guid=C3=A9e?= Date: Mon, 29 Mar 2021 21:38:26 +0200 Subject: [PATCH 2/2] Add pep8 check on push --- .github/workflows/pep8-push.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/pep8-push.yml diff --git a/.github/workflows/pep8-push.yml b/.github/workflows/pep8-push.yml new file mode 100644 index 0000000..a5fe195 --- /dev/null +++ b/.github/workflows/pep8-push.yml @@ -0,0 +1,15 @@ +name: PEP8 check (push) + +on: [push] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: 'Run PEP8' + uses: quentinguidee/pep8-action@v1 + id: run_pep8 + with: + arguments: '--max-line-length=79' + continue-on-error: false