Skip to content

Commit 5189717

Browse files
committed
Gate the rust-src-dir check by first checking if the value is set
1 parent d6688fb commit 5189717

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

action.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,18 @@ runs:
169169
rust_src_dir: ${{inputs.rust-src-dir}}
170170
shell: bash
171171
run: |
172-
if [[ -d "$rust_src_dir" ]]; then
173-
cd "$rust_src_dir"
174-
else
175-
echo "'rust-src-dir' does not point to an existing directory" >&2
176-
echo "The value of 'rust-src-dir' is: ${rust_src_dir}" >&2
177-
exit 1
172+
# Check if value is set
173+
if [[ -n "$rust_src_dir" ]]
174+
then
175+
# If value is set the directory must exist
176+
if [[ -d "$rust_src_dir" ]]
177+
then
178+
cd "$rust_src_dir"
179+
else
180+
echo "'rust-src-dir' does not point to an existing directory" >&2
181+
echo "The value of 'rust-src-dir' is: ${rust_src_dir}" >&2
182+
exit 1
183+
fi
178184
fi
179185
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml") ]]
180186
then

0 commit comments

Comments
 (0)