...
This commit is contained in:
+47
-39
@@ -1,47 +1,55 @@
|
||||
name: "Terraform/OpenTofu PR Commenter"
|
||||
description: "Posts PR comments for Terraform or OpenTofu commands (init/plan/fmt/validate), compatible with Gitea and GitHub."
|
||||
author: "Trez"
|
||||
branding:
|
||||
icon: "message-square"
|
||||
color: "purple"
|
||||
|
||||
inputs:
|
||||
commenter_type:
|
||||
description: "Type of command (init, fmt, validate, plan)"
|
||||
required: true
|
||||
|
||||
commenter_input:
|
||||
description: "Output from the command (e.g. plan output)"
|
||||
required: true
|
||||
|
||||
commenter_exitcode:
|
||||
description: "Exit code of the command"
|
||||
required: true
|
||||
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
|
||||
|
||||
description: "Posts Terraform or OpenTofu command results as PR comments for GitHub/Gitea."
|
||||
author: "Charish Patel"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Run Terraform/OpenTofu PR Commenter
|
||||
shell: bash
|
||||
run: |
|
||||
bash "${GITHUB_ACTION_PATH}/tf-pr-comment.sh" \
|
||||
"${{ inputs.commenter_type }}" \
|
||||
"${{ inputs.commenter_input }}" \
|
||||
"${{ inputs.commenter_exitcode }}" \
|
||||
"${{ inputs.working_directory }}"
|
||||
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.github_token }}
|
||||
PR_NUMBER: ${{ env.PR_NUMBER }}
|
||||
PR_URL: ${{ env.PR_URL }}
|
||||
PR_COMMENTS_URL: ${{ env.PR_COMMENTS_URL }}
|
||||
PR_COMMENT_ID: ${{ env.PR_COMMENT_ID }}
|
||||
PR_COMMENT_URI: ${{ env.PR_COMMENT_URI }}
|
||||
run: bash "${GITHUB_ACTION_PATH}/tf-pr-comment.sh"
|
||||
|
||||
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: true
|
||||
|
||||
pr_comment_id:
|
||||
description: "Existing PR comment ID if updating"
|
||||
required: false
|
||||
|
||||
pr_comment_uri:
|
||||
description: "PR comment URI if updating"
|
||||
required: false
|
||||
|
||||
github_token:
|
||||
description: "GitHub/Gitea token for authentication"
|
||||
required: true
|
||||
|
||||
Reference in New Issue
Block a user