From c6f74e79fdd8858f949c75dfa8d5d006c942c2c2 Mon Sep 17 00:00:00 2001 From: gcattan Date: Mon, 24 Feb 2025 11:06:31 +0100 Subject: [PATCH 1/4] Create formatter.yml --- .github/workflows/formatter.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/formatter.yml diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml new file mode 100644 index 0000000..c2c4884 --- /dev/null +++ b/.github/workflows/formatter.yml @@ -0,0 +1,25 @@ +name: black-action +on: [push, pull_request] +jobs: + linter_name: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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@v7 + 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 3bfcb73e5272e7406f3169fab816045eae428b3f Mon Sep 17 00:00:00 2001 From: gcattan Date: Mon, 24 Feb 2025 11:40:23 +0100 Subject: [PATCH 2/4] Update formatter.yml --- .github/workflows/formatter.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index c2c4884..668d8a0 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -2,24 +2,10 @@ name: black-action on: [push, pull_request] jobs: linter_name: - name: runner / black + name: runner / black formatter runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Check files using the black formatter - uses: rickstaa/action-black@v1 - id: action_black + - uses: actions/checkout@v2 + - uses: datadog/action-py-black-formatter@v2.1 with: - black_args: "." - - name: Create Pull Request - if: steps.action_black.outputs.is_formatted == 'true' - uses: peter-evans/create-pull-request@v7 - 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 + check_mode: "true" From bc31e1925fcea68174868d1326390f4d8c6cfae3 Mon Sep 17 00:00:00 2001 From: gcattan Date: Mon, 24 Feb 2025 11:42:43 +0100 Subject: [PATCH 3/4] Update formatter.yml --- .github/workflows/formatter.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 668d8a0..eddbdeb 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -2,10 +2,22 @@ name: black-action on: [push, pull_request] jobs: linter_name: - name: runner / black formatter + name: runner / black runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: datadog/action-py-black-formatter@v2.1 + - name: Check files using the black formatter + uses: datadog/action-py-black-formatter@v2.1 + id: action_black + - name: Create Pull Request + if: steps.action_black.outputs.is_formatted == 'true' + uses: peter-evans/create-pull-request@v3 with: - check_mode: "true" + 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 502c46bbcb7d6af8b7868819fd66e722125f2eb0 Mon Sep 17 00:00:00 2001 From: gcattan Date: Tue, 25 Feb 2025 15:44:05 +0100 Subject: [PATCH 4/4] Update formatter.yml --- .github/workflows/formatter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index eddbdeb..fb3aef4 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -11,7 +11,7 @@ jobs: id: action_black - name: Create Pull Request if: steps.action_black.outputs.is_formatted == 'true' - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} title: "Format Python code with psf/black push"