From cf4ab5a7b6c5480a36356fd405a69fe1614019ca Mon Sep 17 00:00:00 2001 From: cadenforrest Date: Thu, 15 Jul 2021 14:44:42 -0500 Subject: [PATCH 1/4] autoyapf --- .github/workflows/autoyapf.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/autoyapf.yml diff --git a/.github/workflows/autoyapf.yml b/.github/workflows/autoyapf.yml new file mode 100644 index 0000000..071fa52 --- /dev/null +++ b/.github/workflows/autoyapf.yml @@ -0,0 +1,28 @@ +name: Formatting python code +on: + push: + paths: + - '**.py' +jobs: + autoyapf: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + ref: ${{ github.head_ref }} + - name: autoyapf + id: autoyapf + uses: cadenforrest/autoyapf@v2 + with: + args: --style pep8 --recursive --in-place . + - name: Check for modified files + id: git-check + run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) + - name: Push changes + if: steps.git-check.outputs.modified == 'true' + run: | + git config --global user.name 'Caden Westmoreland' + git config --global user.email 'cadenforrest@users.noreply.github.com' + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + git commit -am "Automated autoyapf fixes" + git push \ No newline at end of file From 66d6575d6a075ad8d69ed7298cc475f352355fd6 Mon Sep 17 00:00:00 2001 From: cadenforrest Date: Sat, 17 Jul 2021 01:35:54 -0500 Subject: [PATCH 2/4] switched to diff method, maybe it will be cool --- .github/workflows/auto-black.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/auto-black.yml diff --git a/.github/workflows/auto-black.yml b/.github/workflows/auto-black.yml new file mode 100644 index 0000000..22154e6 --- /dev/null +++ b/.github/workflows/auto-black.yml @@ -0,0 +1,24 @@ +name: black-action +on: [push, pull_request] +jobs: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check files using the black formatter + uses: rickstaa/action-black@v1 + id: action_black + with: + black_args: "." + - name: Create Pull Request + if: steps.action_black.outputs.is_formatted == 'true' + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: "Format Python code with psf/black push" + commit-message: ":art: Format Python code with psf/black" + body: | + There appear to be some python formatting errors in ${{ github.sha }}. This pull request + uses the [psf/black](https://github.com/psf/black) formatter to fix these issues. + base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch + branch: actions/black \ No newline at end of file From 4a6591f5ab236c74c368869ccf2574df9bbdc38c Mon Sep 17 00:00:00 2001 From: cadenforrest Date: Sat, 17 Jul 2021 01:40:28 -0500 Subject: [PATCH 3/4] bug fix? --- .github/workflows/auto-black.yml | 2 +- .github/workflows/autoyapf.yml | 28 ---------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 .github/workflows/autoyapf.yml diff --git a/.github/workflows/auto-black.yml b/.github/workflows/auto-black.yml index 22154e6..c680271 100644 --- a/.github/workflows/auto-black.yml +++ b/.github/workflows/auto-black.yml @@ -1,7 +1,7 @@ name: black-action on: [push, pull_request] jobs: - name: runner / black + name: runner runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/autoyapf.yml b/.github/workflows/autoyapf.yml deleted file mode 100644 index 071fa52..0000000 --- a/.github/workflows/autoyapf.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Formatting python code -on: - push: - paths: - - '**.py' -jobs: - autoyapf: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - with: - ref: ${{ github.head_ref }} - - name: autoyapf - id: autoyapf - uses: cadenforrest/autoyapf@v2 - with: - args: --style pep8 --recursive --in-place . - - name: Check for modified files - id: git-check - run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) - - name: Push changes - if: steps.git-check.outputs.modified == 'true' - run: | - git config --global user.name 'Caden Westmoreland' - git config --global user.email 'cadenforrest@users.noreply.github.com' - git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - git commit -am "Automated autoyapf fixes" - git push \ No newline at end of file From df2992581a1853b30f47c17d2deb34a171b4c4ee Mon Sep 17 00:00:00 2001 From: cadenforrest Date: Sat, 17 Jul 2021 01:44:10 -0500 Subject: [PATCH 4/4] wtf --- .github/workflows/auto-black.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-black.yml b/.github/workflows/auto-black.yml index c680271..e5e5b85 100644 --- a/.github/workflows/auto-black.yml +++ b/.github/workflows/auto-black.yml @@ -1,7 +1,7 @@ name: black-action on: [push, pull_request] jobs: - name: runner + - name: runner runs-on: ubuntu-latest steps: - uses: actions/checkout@v2