From 518e5ebb85629e90b45a3afdce14818e46af6cdc Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 7 Mar 2024 02:27:53 +0100 Subject: [PATCH] ci(autoblacks): add step to check if black reformatted some code --- .github/workflows/autoblack.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/autoblack.yml b/.github/workflows/autoblack.yml index de552880..369f8882 100644 --- a/.github/workflows/autoblack.yml +++ b/.github/workflows/autoblack.yml @@ -15,8 +15,15 @@ jobs: with: options: "." continue-on-error: true + - shell: pwsh + id: check_files_changed + run: | + # Diff HEAD with the previous commit + $diff = git diff + $HasDiff = $diff.Length -gt 0 + Write-Host "::set-output name=files_changed::$HasDiff" - name: Create Pull Request - if: steps.black.outputs.is_formatted == 'true' + if: steps.check_files_changed.outputs.files_changed == 'true' uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }}