Skip to content

Commit 36f4771

Browse files
committed
nit: automate dep management
1 parent 7320786 commit 36f4771

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/actions/fetch_ctk/action.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,21 @@ runs:
2222
- name: Install dependencies
2323
shell: bash --noprofile --norc -xeuo pipefail {0}
2424
run: |
25-
if (command -v curl 2>&1 >/dev/null) && (command -v zstd 2>&1 >/dev/null); then
25+
dependencies=(zstd curl xz-utils)
26+
dependent_exes=(zstd curl xz)
27+
28+
not_found=0
29+
for dep in ${dependent_exes[@]}; do
30+
if ! (command -v curl 2>&1 >/dev/null); then
31+
not_found=1
32+
break
33+
fi
34+
done
35+
if [[ $not_found == 0 ]]; then
2636
echo "All dependencies are found. Do nothing."
2737
exit 0
2838
fi
29-
if ! command -v sudo 2>&1 >/dev/null; then
39+
if ! (command -v sudo 2>&1 >/dev/null); then
3040
if [[ $EUID == 0 ]]; then
3141
alias SUDO=""
3242
else
@@ -38,7 +48,7 @@ runs:
3848
fi
3949
shopt -s expand_aliases
4050
SUDO apt update
41-
SUDO apt install -y zstd curl xz-utils
51+
SUDO apt install -y ${dependencies[@]}
4252
4353
- name: Download CTK cache
4454
id: ctk-get-cache

0 commit comments

Comments
 (0)