Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code formatter bugs #1247

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/autopep8.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Format python code with autopep8
on: push
on: pull_request
jobs:
autopep8:
runs-on: ubuntu-latest
Expand All @@ -10,29 +10,24 @@ jobs:
uses: peter-evans/autopep8@v2
with:
args: --exit-code --max-line-length 120 --recursive --in-place --aggressive --aggressive .
- name: Get Pull Request Number
id: pr
run: echo "::set-output name=pull_request_number::$(gh pr view --json number -q .number || echo "")"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ steps.pr.outputs.pull_request_number }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
- name: Create comment if autopep8 made NO changes
if: ${{ steps.fc.outputs.comment-id == '' && steps.autopep8.outputs.exit-code != 2}}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ steps.pr.outputs.pull_request_number }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Code has no PEP8 errors!
- name: Create comment if autopep8 made changes
if: ${{ steps.fc.outputs.comment-id == '' && steps.autopep8.outputs.exit-code == 2}}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ steps.pr.outputs.pull_request_number }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Code in this pull request contains PEP8 errors, please write the `/fix-pep8` command in the comments below to create commit with automatic fixes.
- name: Update comment if NOT fixed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reactions: true
commands: fix-pep8
permission: read
permission: none
issue-type: pull-request
Loading