Closed PuneetKohli closed 4 years ago
Hi @PuneetKohli, thank you for opening this issue.
I think this is due to some recent changes to the actions/checkout
action. Please try this updated workflow that should fix the problem.
name: autopep8
on: pull_request
jobs:
autopep8:
# Check if the PR is not from a fork
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: ${{ github.head_ref }}
- name: autopep8
id: autopep8
uses: peter-evans/autopep8@v1.1.0
with:
args: --exit-code --recursive --in-place --aggressive --aggressive .
- name: Commit autopep8 changes
if: steps.autopep8.outputs.exit-code == 2
run: |
git config --global user.name 'Peter Evans'
git config --global user.email 'peter-evans@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.REPO_ACCESS_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated autopep8 fixes"
git push
I will update the documentation to reflect this new change.
By the way, it's not recommend to use actions/checkout@v1.1.0
. That is an unreleased version. It's best to follow the major version with actions/checkout@v1
.
See https://github.com/actions/checkout#v110-unreleased Comments in an unmerged changelog also confirm it's not a good idea to use that version. https://github.com/actions/checkout/pull/64/files#diff-4ac32a78649ca5bdd8e0ba38b7006a1e
We had the issue with checkout@v1 which upgrading to v1.1.0 fixed in a particular repo. That probably wasn't the root cause which is why it cropped up again.
We will try downgrading with the new workflow
Also does aggressive need to be there twice for autopep8 or is that a bug/typo?
Also does aggressive need to be there twice for autopep8 or is that a bug/typo?
It's not a typo, that's the way autopep8 specifies "aggressive level 2." You are free to change the autopep8 arguments to whatever you like. Check the documentation out here: https://github.com/hhatto/autopep8#usage
Thanks for that.
The fix does work for us!
We have often got this failure and are unable to debug it:
Our workflow:
The action code is attached below for reference: