diff --git a/.github/workflows/autoformat.yml b/.github/workflows/autoformat.yml index 7b2fcfad5..f925c3b1b 100644 --- a/.github/workflows/autoformat.yml +++ b/.github/workflows/autoformat.yml @@ -33,7 +33,15 @@ jobs: AWS_SECRET_KEY: ${{ steps.aws_credentials.outputs.aws-secret-access-key }} AWS_SESSION_TOKEN: ${{ steps.aws_credentials.outputs.aws-session-token }} - - name: Commit formatting changes + - name: Check for formatting changes + id: check_formatting_changes + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "changes=true" >> "$GITHUB_OUTPUT"; + fi + + - name: Commit and push formatting changes + if: steps.check_formatting_changes.outputs.changes == 'true' run: | git config user.name "Buildkite on behalf of Wellcome Collection" git config user.email "wellcomedigitalplatform@wellcome.ac.uk"