feat: forbid teapot.env
All checks were successful
push / build (push) Successful in 52s

This commit is contained in:
张泊明518370910136 2025-09-17 01:22:05 -07:00
parent a7527696f2
commit d62dbb5579
GPG Key ID: CA088E6D9284F870

View File

@ -18,7 +18,7 @@ main() {
repo_name=$(basename "$(pwd)") repo_name=$(basename "$(pwd)")
course=${repo_name%-*} course=${repo_name%-*}
if ! [[ "$course" =~ ^[a-zA-Z0-9_-]+$ ]]; then if ! [[ "$course" =~ ^[a-zA-Z0-9_-]+$ ]]; then
echo "FATAL: Invalid course name: $course" echo "FATAL: Invalid course name: $course" >&2
exit 1 exit 1
fi fi
@ -51,6 +51,10 @@ EOF
git -C "$config_repo_path" reset --hard git -C "$config_repo_path" reset --hard
git -C "$config_repo_path" pull --rebase git -C "$config_repo_path" pull --rebase
if [ -e "$config_repo_path/home/tt/.config/teapot/teapot.env" ]; then
echo "FATAL: Forbidden file found in '/home/tt/.config/teapot/teapot.env'. Check the latest README to set TEAPOT_GITEA_TOKEN in secrets instead." >&2
exit 1
fi
rsync -a "$config_repo_path/home/tt/.ssh/" "/home/tt/.ssh" rsync -a "$config_repo_path/home/tt/.ssh/" "/home/tt/.ssh"
rsync -a --delete "$config_repo_path/home/tt/.config/" "/home/tt/.config" rsync -a --delete "$config_repo_path/home/tt/.config/" "/home/tt/.config"
joj3-forge convert "/home/tt/.config/joj" joj3-forge convert "/home/tt/.config/joj"
@ -69,7 +73,7 @@ GITEA_ORG_NAME=$org_name
GITEA_ACCESS_TOKEN=$TEAPOT_GITEA_TOKEN GITEA_ACCESS_TOKEN=$TEAPOT_GITEA_TOKEN
EOF EOF
else else
echo "FATAL: TEAPOT_GITEA_TOKEN not set" echo "FATAL: TEAPOT_GITEA_TOKEN not set" >&2
exit 1 exit 1
fi fi
} }