fix(ci): use head_ref for PR branch in fresh install test

On PR events, github.ref_name resolves to the merge ref (e.g.
"1159/merge") which doesn't exist on raw.githubusercontent.com,
causing a 404. Use github.head_ref (the actual source branch)
for PRs, falling back to ref_name for push events.

Also adds -f flag to curl so HTTP errors fail immediately with
a clear message instead of silently saving the 404 HTML page.
This commit is contained in:
Vijay Janapa Reddi
2026-02-04 10:06:25 -05:00
parent 24ab7599c6
commit 3a2b1bf482
2 changed files with 11 additions and 2 deletions

View File

@@ -71,7 +71,12 @@ echo ""
echo "▶ Step 1: Running install script (branch: $BRANCH)..."
export TINYTORCH_BRANCH="$BRANCH"
export TINYTORCH_NON_INTERACTIVE=1
curl -sSL "https://raw.githubusercontent.com/harvard-edge/cs249r_book/${BRANCH}/tinytorch/site/extra/install.sh" -o /tmp/install.sh
curl -fsSL "https://raw.githubusercontent.com/harvard-edge/cs249r_book/${BRANCH}/tinytorch/site/extra/install.sh" -o /tmp/install.sh || {
echo "✗ Failed to download install script for branch: $BRANCH"
echo " URL: https://raw.githubusercontent.com/harvard-edge/cs249r_book/${BRANCH}/tinytorch/site/extra/install.sh"
echo " Hint: Does the branch '${BRANCH}' exist and contain tinytorch/site/extra/install.sh?"
exit 1
}
bash /tmp/install.sh
cd tinytorch