Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review Plan Output #3

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ inputs:
output_file:
description: 'Path to the Terraform plan output file'
required: true
comment_on_pull_request:
description: 'Whether to comment on the Pull Request or not'
required: false
default: "true"
essential_output_file:
description: 'Name to the essential Terraform plan output file'
required: false
outputs:
essential-plan-output:
runs:
using: 'composite'
steps:
- run: chmod +x ${{ github.action_path }}/src/main.sh
shell: bash
- run: ${{ github.action_path }}/src/main.sh "${{ inputs.output_file }}"
- name: Run
id: run
run: ${{ github.action_path }}/src/main.sh "${{ inputs.output_file }}"
shell: bash
9 changes: 8 additions & 1 deletion src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,12 @@ if [[ -z $clean_essential_output ]]; then
comment_on_pr "Terraform essential output is empty. Please check the plan output."
else
comment_body=$(printf "## Terraform Plan Essential Output\n\`\`\`\n%s\n\`\`\`\n" "$clean_essential_output")
comment_on_pr "$comment_body"
if [[ $comment_on_pull_request == "true" ]]; then
# Comment on the PR
comment_on_pr "$comment_body"
fi
if [[ $essential_output_file != "" ]]; then
# Save the essential output to a file
echo "$comment_body" > "$essential_output_file"
fi
fi
Loading