Skip to content

Commit d698bf4

Browse files
ytmimicalebcartwright
authored andcommitted
use the branch_name as the default for the optional commit hash
There was an issue with the script when passing optional rustfmt configs without specifying a commit hash. Because these optional values are passed via positional arguments the configs ($4) would be used in place of the commit hash ($3). Now that we set a default value for the optional commit hash we avoid this problem.
1 parent e5c212b commit d698bf4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.github/workflows/check_diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
rustup target add x86_64-unknown-linux-gnu
3131
3232
- name: check diff
33-
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 }}
33+
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 }}

ci/check_diff.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function compile_rustfmt() {
115115
git fetch feature $FEATURE_BRANCH
116116

117117
cargo build --release --bin rustfmt && cp target/release/rustfmt $1/rustfmt
118-
if [ -z "$OPTIONAL_COMMIT_HASH" ]; then
118+
if [ -z "$OPTIONAL_COMMIT_HASH" ] || [ "$FEATURE_BRANCH" = "$OPTIONAL_COMMIT_HASH" ]; then
119119
git switch $FEATURE_BRANCH
120120
else
121121
git switch $OPTIONAL_COMMIT_HASH --detach

0 commit comments

Comments
 (0)