From 7725d140c572c5a67352588d84a6ca6f5faab117 Mon Sep 17 00:00:00 2001 From: Nicola Demo Date: Fri, 9 Feb 2024 11:51:43 +0100 Subject: [PATCH 1/4] Create black-formatter.yml --- .github/workflows/black-formatter.yml | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/black-formatter.yml diff --git a/.github/workflows/black-formatter.yml b/.github/workflows/black-formatter.yml new file mode 100644 index 000000000..e7bdcdeaa --- /dev/null +++ b/.github/workflows/black-formatter.yml @@ -0,0 +1,28 @@ +name: black-action + +on: [push, pull_request] + +jobs: + linter: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: psf/black@stable + with: + options: "-l 80" + src: "./pina" + + - 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 From f452df0cc82938f728021085414d5ff7d31ecf9d Mon Sep 17 00:00:00 2001 From: Nicola Demo Date: Fri, 9 Feb 2024 11:59:21 +0100 Subject: [PATCH 2/4] Update black-formatter.yml --- .github/workflows/black-formatter.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/black-formatter.yml b/.github/workflows/black-formatter.yml index e7bdcdeaa..f1a4c3b2d 100644 --- a/.github/workflows/black-formatter.yml +++ b/.github/workflows/black-formatter.yml @@ -15,7 +15,6 @@ jobs: src: "./pina" - name: Create Pull Request - if: steps.action_black.outputs.is_formatted == 'true' uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} From d7251a1309c9a986374ca3d74b7dfa757b7f2626 Mon Sep 17 00:00:00 2001 From: Nicola Demo Date: Fri, 9 Feb 2024 12:07:31 +0100 Subject: [PATCH 3/4] Update black-formatter.yml --- .github/workflows/black-formatter.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/black-formatter.yml b/.github/workflows/black-formatter.yml index f1a4c3b2d..891b70010 100644 --- a/.github/workflows/black-formatter.yml +++ b/.github/workflows/black-formatter.yml @@ -1,6 +1,6 @@ -name: black-action +name: Black Formatter -on: [push, pull_request] +on: push jobs: linter: @@ -10,11 +10,13 @@ jobs: - uses: actions/checkout@v3 - uses: psf/black@stable + id: action_black with: options: "-l 80" src: "./pina" - name: Create Pull Request + if: steps.action_black.outputs.is_formatted == 'true' uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} From 31187ba070aaefc952293930cb9a7db24a88009c Mon Sep 17 00:00:00 2001 From: Nicola Demo Date: Fri, 9 Feb 2024 12:09:03 +0100 Subject: [PATCH 4/4] Update black-formatter.yml --- .github/workflows/black-formatter.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/black-formatter.yml b/.github/workflows/black-formatter.yml index 891b70010..70279d273 100644 --- a/.github/workflows/black-formatter.yml +++ b/.github/workflows/black-formatter.yml @@ -1,7 +1,10 @@ name: Black Formatter -on: push - +on: + push: + branches: + - master + jobs: linter: name: runner / black