diff --git a/scripts/trigger_coreci.sh b/scripts/trigger_coreci.sh index 4eb7094..758cf25 100755 --- a/scripts/trigger_coreci.sh +++ b/scripts/trigger_coreci.sh @@ -5,6 +5,20 @@ set -uo pipefail +# Source .env if present (provides GITEA_TOKEN) +# Look in repo root, then cwd, then script dir +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +for env_file in "$REPO_ROOT/.env" "$PWD/.env" "./.env"; do + if [ -f "$env_file" ]; then + set -a + # shellcheck disable=SC1090 + . "$env_file" + set +a + break + fi +done + CORECI_URL="${CORECI_URL:-https://git.cloudinit.dev/coreci/coreci}" GITEA_TOKEN="${GITEA_TOKEN:-}"