Initial commit.
This commit is contained in:
+73
@@ -0,0 +1,73 @@
|
||||
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"
|
||||
|
||||
# Define the inputs
|
||||
inputs:
|
||||
command:
|
||||
description: "The command type: fmt | init | plan | validate"
|
||||
required: true
|
||||
commenter_input:
|
||||
description: "Stdout or file list from previous Terraform/OpenTofu step"
|
||||
required: true
|
||||
commenter_exitcode:
|
||||
description: "Exit code from previous Terraform/OpenTofu step"
|
||||
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"
|
||||
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
|
||||
|
||||
|
||||
# Define the action type
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Run TF/Tofu PR Commenter
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x ${{ github.action_path }}/tf-pr-comment.sh
|
||||
${{ github.action_path }}/tf-pr-comment.sh "${{ inputs.command }}" "${{ inputs.commenter_input }}" "${{ inputs.commenter_exitcode }}"
|
||||
env:
|
||||
# PR Environment Variables
|
||||
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 }}
|
||||
# Optional highlighting
|
||||
HIGHLIGHT_CHANGES: ${{ inputs.highlight_changes }}
|
||||
TF_WORKSPACE: ${{ inputs.tf_workspace }}
|
||||
|
||||
Reference in New Issue
Block a user