-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,33 @@ 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 | ||
# Check if the PR is not raised by this workflow and is not from a fork | ||
if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
ref: ${{ github.head_ref }} | ||
- name: autopep8 | ||
id: autopep8 | ||
uses: peter-evans/autopep8@v2 | ||
with: | ||
args: --exit-code --recursive --in-place --aggressive --aggressive . | ||
- name: Commit autopep8 changes | ||
if: steps.autopep8.outputs.exit-code == 2 | ||
- name: Set autopep8 branch name | ||
id: vars | ||
run: | | ||
git config --global user.name 'Blüml Jannis' | ||
git config --global user.email '[email protected]' | ||
git commit -am "Automated autopep8 fixes" | ||
git push | ||
branch-name="autopep8-patches/${{ github.head_ref }}" | ||
echo "branch-name=$branch-name" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request | ||
if: steps.autopep8.outputs.exit-code == 2 | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: autopep8 action fixes | ||
title: Fixes by autopep8 action | ||
body: This is an auto-generated PR with fixes by autopep8. | ||
labels: autopep8, automated pr | ||
reviewers: peter-evans | ||
branch: ${{ steps.vars.outputs.branch-name }} | ||
- name: Fail if autopep8 made changes | ||
if: steps.autopep8.outputs.exit-code == 2 | ||
run: exit 1 |