Files
tf-pr-commenter/action.yml
T
2025-11-08 08:29:51 -05:00

48 lines
1.4 KiB
YAML

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
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:
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 }}