Skip to content

Commit

Permalink
Merge pull request #2 from reviewdog/init
Browse files Browse the repository at this point in the history
init
  • Loading branch information
haya14busa authored Sep 20, 2021
2 parents b115c9e + e5b1b53 commit 9a96614
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 85 deletions.
39 changes: 3 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,17 @@
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test-check:
name: runner / <linter-name> (github-check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: info
locale: "US"

test-pr-check:
if: github.event_name == 'pull_request'
name: runner / <linter-name> (github-pr-check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
level: warning
locale: "US"
workdir: ./testdata/subdir/

test-pr-review:
if: github.event_name == 'pull_request'
name: runner / <linter-name> (github-pr-review)
name: runner / shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: error
locale: "US"
reviewdog_flags: -filter-mode=file -fail-on-error
filter_mode: file
reviewdog_flags: -fail-on-error
- name: check the exit code
if: ${{ !success() }}
run: echo 'The previous step should fail' && exit 1
41 changes: 16 additions & 25 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'TODO: Run <linter-name> with reviewdog'
description: 'TODO: 🐶 Run <linter-name> with reviewdog on pull requests to improve code review experience.'
author: 'TODO: <your-name>'
name: 'Run shfmt with reviewdog'
description: '🐶 Run shfmt with reviewdog on pull requests to improve code review experience.'
author: 'haya14busa'
inputs:
github_token:
description: 'GITHUB_TOKEN'
Expand All @@ -12,9 +12,6 @@ inputs:
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-check,github-pr-review].'
default: 'github-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Expand All @@ -28,33 +25,27 @@ inputs:
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
### Flags for <linter-name> ###
locale:
description: '-locale flag of misspell. (US/UK)'
default: ''
### Flags for shfmt ###
shfmt_flags:
description: 'flags for shfmt'
default: '-i 2 -ci'
runs:
using: 'composite'
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.13.0
- run: $GITHUB_ACTION_PATH/script.sh
shell: bash
env:
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_LEVEL: ${{ inputs.level }}
INPUT_REPORTER: ${{ inputs.reporter }}
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}
INPUT_ESLINT_FLAGS: ${{ inputs.eslint_flags }}
INPUT_WORKDIR: ${{ inputs.workdir }}
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_SHFMT_FLAGS: ${{ inputs.shfmt_flags }}
- uses: reviewdog/action-suggester@v1
with:
tool_name: shfmt
github_token: ${{ inputs.github_token }}
level: ${{ inputs.level }}
filter_mode: ${{ inputs.filter_mode }}
fail_on_error: ${{ inputs.fail_on_error }}
reviewdog_flags: ${{ inputs.reviewdog_flags }}

# Ref: https://haya14busa.github.io/github-action-brandings/
# TODO: update branding if you want.
branding:
icon: 'check'
color: 'blue'
Loading

0 comments on commit 9a96614

Please sign in to comment.