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