...
This commit is contained in:
+12
-8
@@ -7,17 +7,22 @@ branding:
|
||||
|
||||
inputs:
|
||||
commenter_type:
|
||||
description: "The Terraform/OpenTofu command type (e.g., init, plan, fmt, validate)"
|
||||
description: "Type of command (init, fmt, validate, plan)"
|
||||
required: true
|
||||
|
||||
commenter_input:
|
||||
description: "Captured stdout/stderr output of the Terraform/OpenTofu command"
|
||||
description: "Output from the command (e.g. plan output)"
|
||||
required: true
|
||||
|
||||
commenter_exitcode:
|
||||
description: "Exit code of the Terraform/OpenTofu command"
|
||||
description: "Exit code of the command"
|
||||
required: true
|
||||
working_dir:
|
||||
description: "Optional working directory relative to the repository root (e.g., cloudflare)"
|
||||
default: "0"
|
||||
|
||||
working_directory:
|
||||
description: "Optional working directory (relative to repo root)"
|
||||
required: false
|
||||
|
||||
github_token:
|
||||
description: "Token used for posting the comment (Gitea or GitHub)"
|
||||
required: true
|
||||
@@ -28,12 +33,11 @@ runs:
|
||||
- name: Run Terraform/OpenTofu PR Commenter
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x "${{ github.action_path }}/tf-pr-comment.sh"
|
||||
"${{ github.action_path }}/tf-pr-comment.sh" \
|
||||
bash "${GITHUB_ACTION_PATH}/tf-pr-comment.sh" \
|
||||
"${{ inputs.commenter_type }}" \
|
||||
"${{ inputs.commenter_input }}" \
|
||||
"${{ inputs.commenter_exitcode }}" \
|
||||
"${{ inputs.working_dir }}"
|
||||
"${{ inputs.working_directory }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.github_token }}
|
||||
PR_NUMBER: ${{ env.PR_NUMBER }}
|
||||
|
||||
@@ -7,6 +7,12 @@ COMMENTER_INPUT="${2:-}"
|
||||
COMMENTER_EXITCODE="${3:-0}"
|
||||
WORKING_DIR="${4:-}"
|
||||
|
||||
# If WORKING_DIR is numeric (likely passed exitcode by mistake), reset it
|
||||
if [[ "$WORKING_DIR" =~ ^[0-9]+$ ]]; then
|
||||
echo "⚠️ Detected numeric working_dir ('$WORKING_DIR'); treating as unset."
|
||||
WORKING_DIR=""
|
||||
fi
|
||||
|
||||
# === Move into working directory if specified ========================
|
||||
if [[ -n "$WORKING_DIR" ]]; then
|
||||
echo "🔹 Changing to working directory: $WORKING_DIR"
|
||||
|
||||
Reference in New Issue
Block a user