Skip to content

Commit

Permalink
feature: hashicorp/terraform:1.4.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sheeeng committed Apr 19, 2023
1 parent 93d6a89 commit ec1c66c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v1.6.0

- Forked from <https://github.com/robburger/terraform-pr-commenter> project.
- Use [hashicorp/terraform:1.4.5](https://hub.docker.com/r/hashicorp/terraform) container base image.

## v1.5.0

- Bump to Terraform v1.0.6 internally (only affects `fmt`)
Expand Down
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
FROM hashicorp/terraform:1.0.6
FROM hashicorp/terraform:1.4.5

LABEL repository="https://github.com/robburger/terraform-pr-commenter" \
homepage="https://github.com/robburger/terraform-pr-commenter" \
maintainer="Rob Burger" \
com.github.actions.name="Terraform PR Commenter" \
com.github.actions.description="Adds opinionated comments to a PR from Terraform fmt/init/plan output" \
com.github.actions.icon="git-pull-request" \
com.github.actions.color="purple"
LABEL \
repository="https://github.com/sheeeng/terraform-pull-request-commenter" \
homepage="https://github.com/sheeeng/terraform-pull-request-commenter" \
maintainer="Leonard Sheng Sheng Lee" \
com.github.actions.name="Terraform Pull Request Commenter" \
com.github.actions.description="Adds opinionated comments to a PR from Terraform fmt/init/plan output." \
com.github.actions.icon="git-pull-request" \
com.github.actions.color="purple"

RUN apk add --no-cache -q \
bash \
curl \
jq
RUN apk add \
--no-cache \
--quiet \
bash=~5 \
curl=~8 \
jq=~1

ADD entrypoint.sh /entrypoint.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 Rob Burger
Copyright (c) 2023 Leonard Sheng Sheng Lee

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Terraform PR Commenter
# Terraform Pull Request Commenter

> This project was forked from <https://github.com/robburger/terraform-pr-commenter> project, originally created by [
Rob Burger](https://github.com/robburger).

Adds opinionated comments to PR's based on Terraform `fmt`, `init`, `plan` and `validate` outputs.

## CURRENTLY WORK IN PROGRESS

## Summary

This Docker-based GitHub Action is designed to work in tandem with [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform) with the **wrapper enabled**, taking the output from a `fmt`, `init`, `plan` or `validate`, formatting it and adding it to a pull request. Any previous comments from this Action are removed to keep the PR timeline clean.
Expand All @@ -15,7 +20,7 @@ Support (for now) is [limited to Linux](https://help.github.com/en/actions/creat
This action can only be run after a Terraform `fmt`, `init`, `plan` or `validate` has completed, and the output has been captured. Terraform rarely writes to `stdout` and `stderr` in the same action, so we concatenate the `commenter_input`:

```yaml
- uses: robburger/terraform-pr-commenter@v1
- uses: sheeeng/terraform-pull-request-commenter@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -55,7 +60,7 @@ jobs:
uses: actions/checkout@v2
...
- name: Post Plan
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXPAND_SUMMARY_DETAILS: 'true' # Override global environment variable; expand details just for this step
Expand Down Expand Up @@ -103,7 +108,7 @@ jobs:
- name: Post Format
if: always() && github.ref != 'refs/heads/master' && (steps.fmt.outcome == 'success' || steps.fmt.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
with:
commenter_type: fmt
commenter_input: ${{ format('{0}{1}', steps.fmt.outputs.stdout, steps.fmt.outputs.stderr) }}
Expand All @@ -115,7 +120,7 @@ jobs:
- name: Post Init
if: always() && github.ref != 'refs/heads/master' && (steps.init.outcome == 'success' || steps.init.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
with:
commenter_type: init
commenter_input: ${{ format('{0}{1}', steps.init.outputs.stdout, steps.init.outputs.stderr) }}
Expand All @@ -127,7 +132,7 @@ jobs:
- name: Post Validate
if: always() && github.ref != 'refs/heads/master' && (steps.validate.outcome == 'success' || steps.validate.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
with:
commenter_type: validate
commenter_input: ${{ format('{0}{1}', steps.validate.outputs.stdout, steps.validate.outputs.stderr) }}
Expand All @@ -139,7 +144,7 @@ jobs:
- name: Post Plan
if: always() && github.ref != 'refs/heads/master' && (steps.plan.outcome == 'success' || steps.plan.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
with:
commenter_type: plan
commenter_input: ${{ format('{0}{1}', steps.plan.outputs.stdout, steps.plan.outputs.stderr) }}
Expand Down Expand Up @@ -182,7 +187,7 @@ jobs:
- name: Post Init - ${{ matrix['workspace'] }}
if: always() && github.ref != 'refs/heads/master' && (steps.init.outcome == 'success' || steps.init.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
with:
commenter_type: init
commenter_input: ${{ format('{0}{1}', steps.init.outputs.stdout, steps.init.outputs.stderr) }}
Expand All @@ -194,7 +199,7 @@ jobs:
- name: Post Plan - ${{ matrix['workspace'] }}
if: always() && github.ref != 'refs/heads/master' && (steps.plan.outcome == 'success' || steps.plan.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
uses: sheeeng/terraform-pull-request-commenter@v1
with:
commenter_type: plan
commenter_input: ${{ format('{0}{1}', steps.plan.outputs.stdout, steps.plan.outputs.stderr) }}
Expand Down Expand Up @@ -230,7 +235,7 @@ In English: "Always run this step, but only on a pull request and only when the

## Troubleshooting & Contributing

Feel free to head over to the [Issues](https://github.com/robburger/terraform-pr-commenter/issues) tab to see if the issue you're having has already been reported. If not, [open a new one](https://github.com/robburger/terraform-pr-commenter/issues/new) and be sure to include as much relevant information as possible, including code-samples, and a description of what you expect to be happening.
Feel free to head over to the [Issues](https://github.com/sheeeng/terraform-pull-request-commenter/issues) tab to see if the issue you're having has already been reported. If not, [open a new one](https://github.com/sheeeng/terraform-pull-request-commenter/issues/new) and be sure to include as much relevant information as possible, including code-samples, and a description of what you expect to be happening.

## License

Expand Down
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: 'Terraform PR Commenter'
description: 'Adds opinionated comments to a PR from Terraform fmt/init/plan output'
author: 'Rob Burger'
name: 'Terraform Pull Request Commenter'
description: 'Adds opinionated comments to a PR from Terraform fmt/init/plan output.'
author: 'Leonard Sheng Sheng Lee'
branding:
icon: 'git-pull-request'
color: 'purple'
inputs:
commenter_type:
description: 'The type of comment. Options: [fmt, init, plan]'
description: 'The type of comment. Options: [fmt, init, plan].'
required: true
commenter_input:
description: 'The comment to post from a previous step output'
description: 'The comment to post from a previous step output.'
required: true
commenter_exitcode:
description: 'The exit code from a previous step output'
description: 'The exit code from a previous step output.'
required: true
runs:
using: 'docker'
Expand Down
Empty file modified entrypoint.sh
100644 → 100755
Empty file.

0 comments on commit ec1c66c

Please sign in to comment.