Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add directory argument #15

Merged
merged 14 commits into from
May 16, 2020
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