Skip to content

Commit d6688fb

Browse files
committed
Print an error and exit if 'rust-src-dir' does not point to an existing directory
1 parent 02be93d commit d6688fb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ runs:
171171
run: |
172172
if [[ -d "$rust_src_dir" ]]; then
173173
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
174178
fi
175179
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml") ]]
176180
then
@@ -201,7 +205,12 @@ runs:
201205
- id: versions
202206
name: Print installed versions
203207
shell: bash
208+
env:
209+
rust_src_dir: ${{inputs.rust-src-dir}}
204210
run: |
211+
# Switch to the selected sub-directory for
212+
cd "$rust_src_dir"
213+
205214
echo "rustc-version=$(rustc --version)" >> $GITHUB_OUTPUT
206215
rustc --version --verbose
207216
echo "cargo-version=$(cargo --version)" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)