...
This commit is contained in:
+23
-56
@@ -1,76 +1,43 @@
|
||||
name: "Terraform/OpenTofu PR Commenter"
|
||||
description: "Posts Terraform/OpenTofu `fmt`, `init`, `plan`, or `validate` results as PR comments on GitHub or Gitea."
|
||||
author: "Charish Patel"
|
||||
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:
|
||||
command:
|
||||
description: "The command type: fmt | init | plan | validate"
|
||||
commenter_type:
|
||||
description: "The Terraform/OpenTofu command type (e.g., init, plan, fmt, validate)"
|
||||
required: true
|
||||
commenter_input:
|
||||
description: "Stdout or file list from previous Terraform/OpenTofu step"
|
||||
description: "Captured stdout/stderr output of the Terraform/OpenTofu command"
|
||||
required: true
|
||||
commenter_exitcode:
|
||||
description: "Exit code from previous Terraform/OpenTofu step"
|
||||
description: "Exit code of the Terraform/OpenTofu command"
|
||||
required: true
|
||||
pr_number:
|
||||
description: "PR number"
|
||||
required: false
|
||||
pr_comments_url:
|
||||
description: "URL for PR comments API"
|
||||
required: false
|
||||
pr_comment_uri:
|
||||
description: "URI for individual PR comment API"
|
||||
working_dir:
|
||||
description: "Optional working directory relative to the repository root (e.g., cloudflare)"
|
||||
required: false
|
||||
github_token:
|
||||
description: "GitHub token (if running in GitHub Actions)"
|
||||
required: false
|
||||
gitea_token:
|
||||
description: "Gitea token (if running in Gitea Actions)"
|
||||
required: false
|
||||
gitea_action:
|
||||
description: "Set to true if running in Gitea Actions"
|
||||
required: false
|
||||
default: "false"
|
||||
gitea_api_url:
|
||||
description: "Gitea API URL"
|
||||
required: false
|
||||
gitea_repository:
|
||||
description: "Gitea repository in format owner/repo"
|
||||
required: false
|
||||
highlight_changes:
|
||||
description: "Set to false to disable diff highlighting"
|
||||
required: false
|
||||
default: "true"
|
||||
tf_workspace:
|
||||
description: "Terraform/OpenTofu workspace (default: 'default')"
|
||||
required: false
|
||||
default: default
|
||||
working_directory:
|
||||
description: "Optional working directory relative to repo root; if set, script runs there"
|
||||
required: false
|
||||
default: ""
|
||||
description: "Token used for posting the comment (Gitea or GitHub)"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Run TF/Tofu PR Commenter
|
||||
- name: Run Terraform/OpenTofu PR Commenter
|
||||
shell: bash
|
||||
run: |
|
||||
pwd ; echo -e "${{ github.action_path }}"
|
||||
chmod +x ${{ github.action_path }}/tf-pr-comment.sh
|
||||
${{ github.action_path }}/tf-pr-comment.sh \
|
||||
"${{ inputs.command }}" \
|
||||
chmod +x "${{ github.action_path }}/tf-pr-comment.sh"
|
||||
"${{ github.action_path }}/tf-pr-comment.sh" \
|
||||
"${{ inputs.commenter_type }}" \
|
||||
"${{ inputs.commenter_input }}" \
|
||||
"${{ inputs.commenter_exitcode }}" \
|
||||
"${{ inputs.working_directory }}"
|
||||
"${{ inputs.working_dir }}"
|
||||
env:
|
||||
PR_NUMBER: ${{ inputs.pr_number }}
|
||||
PR_COMMENTS_URL: ${{ inputs.pr_comments_url }}
|
||||
PR_COMMENT_URI: ${{ inputs.pr_comment_uri }}
|
||||
GITHUB_TOKEN: ${{ inputs.github_token }}
|
||||
GITEA_TOKEN: ${{ inputs.gitea_token }}
|
||||
GITEA_ACTION: ${{ inputs.gitea_action }}
|
||||
GITEA_API_URL: ${{ inputs.gitea_api_url }}
|
||||
GITEA_REPOSITORY: ${{ inputs.gitea_repository }}
|
||||
HIGHLIGHT_CHANGES: ${{ inputs.highlight_changes }}
|
||||
TF_WORKSPACE: ${{ inputs.tf_workspace }}
|
||||
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 }}
|
||||
|
||||
Reference in New Issue
Block a user