diff --git a/bin/joj3-forge-convert b/bin/joj3-forge-convert index ea253a4..8452b3c 100755 --- a/bin/joj3-forge-convert +++ b/bin/joj3-forge-convert @@ -1,11 +1,10 @@ #!/usr/bin/bash set -ex -if [ -z "$1" ]; then - COURSE=$(hostname | cut -d'/' -f2 | cut -d'-' -f1) -else - COURSE="$1" -fi +ORG_NAME=$(basename "$(dirname "$(pwd)")") +REPO_NAME=$(basename "$(pwd)") + +COURSE=${REPO_NAME%-*} CONFIG_REPO_PATH="/home/tt/.cache/$COURSE-config" GRADING_REPO_PATH="/home/tt/.cache/$COURSE-joj" GIT_USER="bot-$COURSE" @@ -40,3 +39,8 @@ if ! git -C "$CONFIG_REPO_PATH" diff --staged --quiet; then git -C "$CONFIG_REPO_PATH" commit -m "chore: joj3-forge convert [skip ci]" git -C "$CONFIG_REPO_PATH" push fi +if [ -n "$TEAPOT_GITEA_TOKEN" ]; then + mkdir -p /home/tt/.config/teapot + echo "GITEA_ORG_NAME=$ORG_NAME" >"/home/tt/.config/teapot/teapot.env" + echo "GITEA_ACCESS_TOKEN=$TEAPOT_GITEA_TOKEN" >>"/home/tt/.config/teapot/teapot.env" +fi