Skip to content

Commit

Permalink
feat: add job summary (#36)
Browse files Browse the repository at this point in the history
* feat: this small feature adds the terraform plan output to the workflow job summary giving an additional place to review the plan outside of the PR comment
  • Loading branch information
RobertKelly authored Jan 9, 2023
1 parent f242763 commit 01d3b49
Show file tree
Hide file tree
Showing 11 changed files with 12,430 additions and 13,262 deletions.
1 change: 1 addition & 0 deletions .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
with:
json-file: test-data/tf_test.json
expand-comment: 'true'
include-plan-job-summary: 'true'

- name: Test PR Commenter with no changes
uses: ./
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# dist release output
dist

# Logs
logs
*.log
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,31 @@ Implementing this Action is _super_ simple and the comments are consise and easy
## Example usage
Single plan file:
```yaml
uses: liatrio/terraform-change-pr-commenter@v1.3.3
uses: liatrio/terraform-change-pr-commenter@v1.4.0
with:
json-file: my-tfplan.json
expand-comment: 'true'
```
Multiple plan files:
```yaml
uses: liatrio/terraform-change-pr-commenter@v1.3.3
uses: liatrio/terraform-change-pr-commenter@v1.4.0
with:
json-file: |
core-infra-tfplan.json
shared-infra-tfplan.json
```
Include plan output to the Actions workflow job summary:
```yaml
uses: liatrio/terraform-change-pr-commenter@v1.4.0
with:
json-file: my-tfplan.json
expand-comment: 'true'
include-plan-job-summary: 'true'
```
**Note:**
- When `include-plan-job-summary = true`, if the action is executed in non-Pull Request workflows, the plan output will also be posted to the job summary of that run. If you do not wish to have this behavior, apply conditional logic to your workflow file.
#### Example Job Summary Output
![Plan output job summary](assets/plan-output-job-summary.png)

## Terraform Configuration / Known Issues
#### Known issue when including the [Terraform Wrapper script](https://github.com/hashicorp/setup-terraform#inputs)
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
description: If true, expand the details comment by default
required: false
default: 'false'
include-plan-job-summary:
description: If true, add the results of the plan to the workflow job summary
required: false
default: 'false'
runs:
using: node16
main: dist/index.js
Binary file added assets/plan-output-job-summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 01d3b49

Please # to comment.