Skip to content

Commit

Permalink
Merge pull request #15 from hazcod/patch-1
Browse files Browse the repository at this point in the history
feature: add directory argument
  • Loading branch information
haya14busa committed May 16, 2020
2 parents 0c5a792 + 57c8567 commit af8c28e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ jobs:
level: warning
reporter: "github-check"

golangci-lint-workdir:
name: runner / golangci-lint (workdir)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint (workdir)
uses: ./ # Build with Dockerfile
with:
workdir: "./testdata"
golangci_lint_flags: ""
tool_name: "golangci-lint-workdir"
level: warning
reporter: "github-check"
filter_mode: "file"

golangci-lint-all-in-one:
name: runner / golangci-lint-all-in-one
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ actions with different config.
Optional. Report level for reviewdog [info,warning,error].
It's same as `-level` flag of reviewdog.

### `workdir`

Optional. Working directory relative to the root directory.

### `reporter`

Optional. Reporter of reviewdog command [github-pr-check,github-pr-review].
Expand Down Expand Up @@ -102,6 +106,7 @@ jobs:
# Can pass --config flag to change golangci-lint behavior and target
# directory.
golangci_lint_flags: "--config=.github/.golangci.yml ./testdata"
workdir: subdirectory/

# Use golint via golangci-lint binary with "warning" level.
golint:
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ inputs:
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
workdir:
description: 'Working directory relative to the root directory.'
default: '.'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

cd "$GITHUB_WORKSPACE" || exit 1
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

Expand Down
2 changes: 1 addition & 1 deletion testdata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func Main( ) {
// langauge

x := 1
x := 2
x += 1
fmt.Sprintf("%d")

Expand Down

0 comments on commit af8c28e

Please sign in to comment.