From 77a5689f0b66a0e3080ccf2e416ef4263faec9d1 Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 25 Nov 2019 08:21:41 +0100 Subject: [PATCH 01/10] action.yaml: add directory arg --- action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.yml b/action.yml index a372b4d9..ee4949f8 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,9 @@ inputs: level: description: 'Report level for reviewdog [info,warning,error]' default: 'error' + directory: + description: 'The subdirectory to execute the action in.' + default: '' runs: using: 'docker' image: 'Dockerfile' From 8a6d8d85fdbe52cd81d560699c5dbfc9ebc27e51 Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 25 Nov 2019 08:22:42 +0100 Subject: [PATCH 02/10] action: add inputs --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index ee4949f8..c4c919e5 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,7 @@ runs: - ${{ inputs.golangci_lint_flags }} - ${{ inputs.tool_name }} - ${{ inputs.level }} + - ${{ inputs.directory }} branding: icon: 'check-circle' color: 'blue' From fdf33f14666f82cc7080a955660968681752dc43 Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 25 Nov 2019 08:24:13 +0100 Subject: [PATCH 03/10] entrypoint: add directory --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3bac35bf..156684dd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd "$GITHUB_WORKSPACE" +cd "${GITHUB_WORKSPACE}/${INPUT_DIRECTORY}" export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" From d217fd40b303a338e7a3249bf31383c46fe7bac5 Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 25 Nov 2019 08:24:47 +0100 Subject: [PATCH 04/10] entrypoint: add directory --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3bac35bf..156684dd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd "$GITHUB_WORKSPACE" +cd "${GITHUB_WORKSPACE}/${INPUT_DIRECTORY}" export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" From b584325a2ef8ebfe8dfbd0628a2096f1c2457507 Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 25 Nov 2019 08:33:40 +0100 Subject: [PATCH 05/10] fix padding --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c4c919e5..62920239 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,7 @@ inputs: level: description: 'Report level for reviewdog [info,warning,error]' default: 'error' - directory: + directory: description: 'The subdirectory to execute the action in.' default: '' runs: From b3248aacb7577926d3272372831eaaa58501c081 Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 25 Nov 2019 08:54:50 +0100 Subject: [PATCH 06/10] readme: add directory --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8a996aa2..35006e15 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ actions with different config. Optional. Report level for reviewdog [info,warning,error]. It's same as `-level` flag of reviewdog. +### `directory` +Optional. The subdirectory where your Go code resides. + ## Example usage ### Minimum Usage Example @@ -87,6 +90,7 @@ jobs: # Can pass --config flag to change golangci-lint behavior and target # directory. golangci_lint_flags: "--config=.github/.golangci.yml ./testdata" + directory: subdirectory/ # Use golint via golangci-lint binary with "warning" level. golint: From d7c0ca11dbfe6c11258d8e74965f92dced2cdbe9 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 16 May 2020 07:43:13 +0000 Subject: [PATCH 07/10] remove args --- action.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/action.yml b/action.yml index d814c63d..ae2e36f0 100644 --- a/action.yml +++ b/action.yml @@ -37,12 +37,6 @@ inputs: runs: using: 'docker' image: 'Dockerfile' - args: - - ${{ inputs.github_token }} - - ${{ inputs.golangci_lint_flags }} - - ${{ inputs.tool_name }} - - ${{ inputs.level }} - - ${{ inputs.directory }} branding: icon: 'check-circle' color: 'blue' From 049d4ddb13b93892754220ab4eb051f7229020c1 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 16 May 2020 07:44:41 +0000 Subject: [PATCH 08/10] replace directory with workdir --- README.md | 6 +++--- action.yml | 6 +++--- entrypoint.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fa082efc..f2834215 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@ actions with different config. Optional. Report level for reviewdog [info,warning,error]. It's same as `-level` flag of reviewdog. -### `directory` +### `workdir` -Optional. The subdirectory where your Go code resides. +Optional. Working directory relative to the root directory. ### `reporter` @@ -106,7 +106,7 @@ jobs: # Can pass --config flag to change golangci-lint behavior and target # directory. golangci_lint_flags: "--config=.github/.golangci.yml ./testdata" - directory: subdirectory/ + workdir: subdirectory/ # Use golint via golangci-lint binary with "warning" level. golint: diff --git a/action.yml b/action.yml index ae2e36f0..7b4dd091 100644 --- a/action.yml +++ b/action.yml @@ -31,9 +31,9 @@ inputs: reviewdog_flags: description: 'Additional reviewdog flags' default: '' - directory: - description: 'The subdirectory to execute the action in.' - default: '' + workdir: + description: 'Working directory relative to the root directory.' + default: '.' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 958ede83..4ab27324 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/sh -cd "${GITHUB_WORKSPACE}/${INPUT_DIRECTORY}" || exit 1 +cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1 export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" From aa7e2c902938f9ee279a2dc26757ef5e12c5afbe Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 16 May 2020 07:47:25 +0000 Subject: [PATCH 09/10] add integration test --- .github/workflows/reviewdog.yml | 14 ++++++++++++++ testdata/main.go | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 371f04a5..a29bd427 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -57,6 +57,20 @@ 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" + golangci-lint-all-in-one: name: runner / golangci-lint-all-in-one runs-on: ubuntu-latest diff --git a/testdata/main.go b/testdata/main.go index a593e4a4..cbd7b822 100644 --- a/testdata/main.go +++ b/testdata/main.go @@ -8,7 +8,7 @@ import ( func Main( ) { // langauge - x := 1 + x := 2 x += 1 fmt.Sprintf("%d") From 57c856730cc12f3f5484aab42ee1c9b0baa2c3af Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 16 May 2020 08:26:53 +0000 Subject: [PATCH 10/10] filter_mode: file for workdir test --- .github/workflows/reviewdog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index a29bd427..5667dd2b 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -70,6 +70,7 @@ jobs: 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