Skip to content

Commit 93b8700

Browse files
feat: add token support to install script tests for improved authentication
1 parent 3a66bf3 commit 93b8700

2 files changed

Lines changed: 36 additions & 4 deletions

File tree

.github/workflows/install-script-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
shell: bash
3232
run: |
3333
chmod +x install-cli.sh
34-
bash bin/test_install_script.sh
34+
bash bin/test_install_script.sh --token ${{ secrets.GITHUB_TOKEN }}
3535
3636
mac-homebrew:
3737
name: Test Homebrew Installation on macOS
@@ -53,4 +53,4 @@ jobs:
5353
shell: bash
5454
run: |
5555
chmod +x install-cli.sh
56-
bash bin/test_install_script_over_homebrew.sh
56+
bash bin/test_install_script_over_homebrew.sh --token ${{ secrets.GITHUB_TOKEN }}

bin/test_install_script_over_homebrew.sh

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,40 @@
22

33
# Note: set -e is intentionally omitted here to allow manual exit code checking.
44

5-
# Attempt to run the install script
6-
./install-cli.sh
5+
# --- Configuration ---
6+
TOKEN=""
7+
8+
# Parse arguments for the test script itself, primarily to pass --token
9+
while [[ "$#" -gt 0 ]]; do
10+
case $1 in
11+
--token)
12+
if [[ -n "$2" && "$2" != --* ]]; then
13+
TOKEN="$2"
14+
shift
15+
else
16+
echo "Error: --token requires a value"
17+
exit 1
18+
fi
19+
;;
20+
*) echo "Unknown parameter: $1"; exit 1 ;;
21+
esac
22+
shift
23+
done
24+
25+
# Helper to construct command
26+
run_install() {
27+
local cmd="./install-cli.sh"
28+
if [ -n "$TOKEN" ]; then
29+
cmd="$cmd --token $TOKEN"
30+
fi
31+
# Add other arguments passed to function
32+
cmd="$cmd $@"
33+
echo "Running: $cmd"
34+
$cmd
35+
}
36+
37+
# Run the install script
38+
run_install
739

840
# Capture the exit code of the install script
941
EXIT_CODE=$?

0 commit comments

Comments
 (0)