From 2cd6ba30987ac1cb4312d6a2011c9a44f6007a2f Mon Sep 17 00:00:00 2001 From: Frank Lee Date: Tue, 7 Mar 2023 13:35:45 +0800 Subject: [PATCH] [workflow] fixed the post-commit failure when no formatting needed (#3020) * [workflow] fixed the post-commit failure when no formatting needed * polish code * polish code * polish code --- .github/workflows/post_commit.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/post_commit.yml b/.github/workflows/post_commit.yml index 765a4d428..bf93eabbf 100644 --- a/.github/workflows/post_commit.yml +++ b/.github/workflows/post_commit.yml @@ -68,7 +68,11 @@ jobs: done # create commit for pre-commit + # when all files are well formatted, there is no need to create a commit + # therefore, this step will produce an error, which should be allowed - name: Create commits + id: commit + continue-on-error: true run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' @@ -78,6 +82,7 @@ jobs: # create pull request - name: Create Pull Request + if: steps.commit.outputs.status == 'success' id: cpr uses: peter-evans/create-pull-request@v4 with: @@ -85,6 +90,7 @@ jobs: title: "[format] applied code formatting on changed files in PR ${{ github.event.pull_request.number }}" - name: Enable Auto-merge for the New PR + if: steps.commit.outputs.status == 'success' uses: peter-evans/enable-pull-request-automerge@v2 with: pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}