From ec1c66c587df12b1a9850d075945ad6e0639cde5 Mon Sep 17 00:00:00 2001 From: Leonard Sheng Sheng Lee Date: Wed, 19 Apr 2023 15:47:07 +0200 Subject: [PATCH] feature: hashicorp/terraform:1.4.5 release --- CHANGELOG.md | 5 +++++ Dockerfile | 29 ++++++++++++++++------------- LICENSE | 1 + README.md | 25 +++++++++++++++---------- action.yml | 12 ++++++------ entrypoint.sh | 0 6 files changed, 43 insertions(+), 29 deletions(-) mode change 100644 => 100755 entrypoint.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ea38be..be17ab0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v1.6.0 + +- Forked from 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`) diff --git a/Dockerfile b/Dockerfile index d674178..9870e89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/LICENSE b/LICENSE index 5e66944..9ec5f7e 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index a51a1b4..3a89e55 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ -# Terraform PR Commenter +# Terraform Pull Request Commenter + +> This project was forked from 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. @@ -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: @@ -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 @@ -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) }} @@ -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) }} @@ -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) }} @@ -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) }} @@ -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) }} @@ -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) }} @@ -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 diff --git a/action.yml b/action.yml index ea2f246..3c37070 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/entrypoint.sh b/entrypoint.sh old mode 100644 new mode 100755