56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
name: "Terraform/OpenTofu PR Commenter"
|
|
description: "Posts Terraform or OpenTofu command results as PR comments for GitHub/Gitea."
|
|
author: "Charish Patel"
|
|
|
|
inputs:
|
|
commenter_type:
|
|
description: "Type of command: init, fmt, validate, plan"
|
|
required: true
|
|
|
|
commenter_input:
|
|
description: "Output from the command (multi-line allowed)"
|
|
required: true
|
|
|
|
commenter_exitcode:
|
|
description: "Exit code from the command"
|
|
required: true
|
|
default: "0"
|
|
|
|
working_directory:
|
|
description: "Optional working directory relative to repo root"
|
|
required: false
|
|
|
|
pr_comments_url:
|
|
description: "PR comments URL (GitHub or Gitea)"
|
|
required: false
|
|
|
|
pr_comment_id:
|
|
description: "Existing PR comment ID if updating"
|
|
required: false
|
|
|
|
pr_comment_uri:
|
|
description: "PR comment URI if updating"
|
|
required: false
|
|
|
|
git_token:
|
|
description: "GitHub/Gitea token for authentication"
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Run Terraform/OpenTofu PR Commenter
|
|
shell: bash
|
|
env:
|
|
# Inputs
|
|
COMMENTER_TYPE: ${{ inputs.commenter_type }}
|
|
COMMENTER_INPUT: ${{ inputs.commenter_input }}
|
|
COMMENTER_EXITCODE: ${{ inputs.commenter_exitcode }}
|
|
WORKING_DIR: ${{ inputs.working_directory }}
|
|
|
|
# PR & auth
|
|
PR_COMMENTS_URL: ${{ inputs.pr_comments_url }}
|
|
PR_COMMENT_ID: ${{ inputs.pr_comment_id }}
|
|
PR_COMMENT_URI: ${{ inputs.pr_comment_uri }}
|
|
GITHUB_TOKEN: ${{ inputs.git_token }}
|
|
run: bash "${GITHUB_ACTION_PATH}/tf-pr-comment.sh" |