Skip to content

Commit

Permalink
fix: remove backend, update README (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
maruloop authored Feb 11, 2024
1 parent b6ab7c6 commit 6e9a4f4
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
if: github.event_name == 'pull_request'
name: runner / terraform validate (github-pr-review)
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: ./
Expand All @@ -43,6 +45,3 @@ jobs:
level: error
reviewdog_flags: -filter-mode=file -fail-on-error
workdir: ./testdata/
envvar: |
KEY1=value1
KEY2=value2
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Folders to ignore
.vscode/
.vscode/
.DS_Store
.terraform
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/maruLoop/action-terraform-validate?logo=github&sort=semver)](https://github.com/maruLoop/action-terraform-validate/releases)
[![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr)

![github-pr-review demo](https://user-images.githubusercontent.com/3797062/73162963-4b8e2b00-4132-11ea-9a3f-f9c6f624c79f.png)
![github-pr-check demo](https://user-images.githubusercontent.com/3797062/73163032-70829e00-4132-11ea-8481-f213a37db354.png)
![github-pr-review demo](images/pr-comment.png)
![github-pr-check demo](images/pr-check.png)

This action runs [terraform validate](https://developer.hashicorp.com/terraform/cli/commands/validate) with [reviewdog](https://github.com/reviewdog/reviewdog) on pull requests to improve experience.

Expand Down Expand Up @@ -43,10 +43,6 @@ inputs:
description: 'Additional reviewdog flags'
default: ''
### Variables for Terraform ###
terraform_init_options:
description: 'options for terraform init to pass backend configuration and so on'
envvars:
description: 'Environment variables for terraform init to pass backend configuration'
terraform_version:
description: 'The terraform version to install and use. The default is `latest`'
```
Expand All @@ -70,6 +66,4 @@ jobs:
# Change reporter level if you need.
# GitHub Status Check won't become failure with warning.
level: warning
envvars: |
AWS_REGION=ap-northeast-1
```
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ inputs:
description: 'Additional reviewdog flags'
default: ''
### Variables for terraform validate ###
terraform_init_options:
description: 'options for terraform init to pass backend configuration and so on'
envvars:
description: 'Environment variables for terraform init to pass backend configuration'
terraform_version:
description: 'The terraform version to install and use. The default is `latest`'
runs:
Expand Down
5 changes: 1 addition & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ if [ -n "${GITHUB_WORKSPACE}" ] ; then
fi

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
echo "${INPUT_ENVVARS}" | while IFS= read -r line; do
export line
done

terraform init -backend=false
# shellcheck disable=SC2086
terraform init ${INPUT_TERRAFORM_INIT_OPTIONS}
terraform validate -json \
| jq -r '.diagnostics[] | "\(.range.filename):\(.range.start.line):\(.range.start.column): \(.detail)"' \
| reviewdog -efm="%f:%l:%c:%m" \
Expand Down
Binary file added images/pr-check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/pr-comment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e9a4f4

Please sign in to comment.