diff --git a/.github/workflows/check_diff.yml b/.github/workflows/check_diff.yml index 8bfb5834519..2f2beb76915 100644 --- a/.github/workflows/check_diff.yml +++ b/.github/workflows/check_diff.yml @@ -30,4 +30,4 @@ jobs: rustup target add x86_64-unknown-linux-gnu - name: check diff - run: bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.commit_hash }} ${{ github.event.inputs.rustfmt_configs }} + run: bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.commit_hash || github.event.inputs.branch_name }} ${{ github.event.inputs.rustfmt_configs }} diff --git a/ci/check_diff.sh b/ci/check_diff.sh index a685c2e108e..50c58b1f492 100755 --- a/ci/check_diff.sh +++ b/ci/check_diff.sh @@ -115,7 +115,7 @@ function compile_rustfmt() { git fetch feature $FEATURE_BRANCH cargo build --release --bin rustfmt && cp target/release/rustfmt $1/rustfmt - if [ -z "$OPTIONAL_COMMIT_HASH" ]; then + if [ -z "$OPTIONAL_COMMIT_HASH" ] || [ "$FEATURE_BRANCH" = "$OPTIONAL_COMMIT_HASH" ]; then git switch $FEATURE_BRANCH else git switch $OPTIONAL_COMMIT_HASH --detach