Skip to content

Commit

Permalink
Add name input to prevent reviewdog from overwriting comments from …
Browse files Browse the repository at this point in the history
…other runs (#39)

* Add `-name` input for the action

* Add an explanation for `-name` input in  README

* Correct English

* Revise README
  • Loading branch information
h-matsuo authored Nov 1, 2024
1 parent 0578334 commit 5c971bf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ inputs:
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
name:
description: |
Tool name shown in review comment for reviewdog.
Also acts as an identifier for determining which comments reviewdog should overwrite.
Useful in monorepos with multiple root modules where terraform validate needs to run multiple times.
default: 'terraform validate'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
Expand All @@ -49,6 +55,8 @@ inputs:
## Usage
### For single root module
```yaml
name: reviewdog
on: [pull_request]
Expand All @@ -67,3 +75,30 @@ jobs:
# GitHub Status Check won't become failure with warning.
level: warning
```
### For multiple root modules
```yaml
name: reviewdog
on: [pull_request]
jobs:
terraform_validate:
name: runner / terraform validate
strategy:
matrix:
root_module:
- development
- production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-terraform-validate@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning
# Explicitly specify a root module path for each job.
workdir: ./terraform/${{ matrix.root_module }}
# Explicitly specify a unique name for each job to prevent reviewdog from overwriting comments across jobs.
name: terraform validate ${{ matrix.root_module }}
```
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ inputs:
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
name:
description: |
Tool name shown in review comment for reviewdog.
Also acts as an identifier for determining which comments reviewdog should overwrite.
Useful in monorepos with multiple root modules where terraform validate needs to run multiple times.
default: 'terraform validate'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ terraform init -backend=false
terraform validate -json \
| jq "$jq_script" -c \
| reviewdog -f="rdjsonl" \
-name="terraform validate" \
-name="${INPUT_NAME}" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
Expand Down

0 comments on commit 5c971bf

Please sign in to comment.