diff --git a/tf-pr-comment.sh b/tf-pr-comment.sh index 7594ec8..093ff0d 100644 --- a/tf-pr-comment.sh +++ b/tf-pr-comment.sh @@ -12,7 +12,7 @@ PR_COMMENT_ID="${PR_COMMENT_ID:-}" PR_COMMENT_URI="${PR_COMMENT_URI:-}" GITHUB_TOKEN="${GITHUB_TOKEN:-}" -# === Validate inputs ================================================= +# === Validate required inputs ======================================== if [[ -z "$COMMENTER_TYPE" ]]; then echo "❌ commenter_type is required." exit 1 @@ -24,7 +24,7 @@ if [[ -z "$GITHUB_TOKEN" ]]; then fi # === Move into working directory if specified ======================== -if [[ -n "$WORKING_DIR" ]]; then +if [[ -n "$WORKING_DIR" && "$WORKING_DIR" != "0" ]]; then TARGET_DIR="${GITHUB_WORKSPACE}/${WORKING_DIR}" if [[ ! -d "$TARGET_DIR" ]]; then echo "❌ Error: Cannot change to working directory '${WORKING_DIR}'" @@ -33,6 +33,7 @@ if [[ -n "$WORKING_DIR" ]]; then echo "🔹 Changing to working directory: $WORKING_DIR" cd "$TARGET_DIR" else + echo "⚠️ Detected empty or numeric working_dir ('${WORKING_DIR:-unset}'); treating as unset." cd "${GITHUB_WORKSPACE:-.}" fi