From 841692ba020718f007f858eaccf486cff572d81d Mon Sep 17 00:00:00 2001 From: k1LoW Date: Tue, 19 Sep 2023 10:10:22 +0900 Subject: [PATCH] Fix work-dir --- action.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index d09cf77..d2e714a 100644 --- a/action.yml +++ b/action.yml @@ -58,7 +58,7 @@ inputs: work-dir: description: 'Directory in which to run gostyle' required: false - default: '' + default: '.' config-file: description: 'Config file path for gostyle.' required: false @@ -94,18 +94,11 @@ runs: if: inputs.use-reviewdog != 'false' run: go install github.com/reviewdog/reviewdog/cmd/reviewdog@${{ inputs.reviewdog-version }} shell: bash - - name: Set package - id: package - run: | - if [ -z "${{ inputs.work-dir }}" ]; then echo "PACKAGE=${{ inputs.go-package }}" >> "$GITHUB_OUTPUT"; fi - if [ -n "${{ inputs.work-dir }}" ]; then echo "PACKAGE=${{ inputs.work-dir }}/${{ inputs.go-package }}" >> "$GITHUB_OUTPUT"; fi - shell: bash - name: Set flags id: flags run: | if [ -z "${{ inputs.config-file }}" ]; then echo "FLAGS=${{ inputs.flags }}" >> "$GITHUB_OUTPUT"; fi - if [ -n "${{ inputs.config-file }}" ] && [ -z "${{ inputs.work-dir }}" ]; then echo "FLAGS=-gostyle.config=${PWD}/${{ inputs.config-file }}" >> "$GITHUB_OUTPUT"; fi - if [ -n "${{ inputs.config-file }}" ] && [ -n "${{ inputs.work-dir }}" ]; then echo "FLAGS=-gostyle.config=${PWD}/${{ inputs.work-dir }}/${{ inputs.config-file }}" >> "$GITHUB_OUTPUT"; fi + if [ -n "${{ inputs.config-file }}" ]; then echo "FLAGS=-gostyle.config=${PWD}/${{ inputs.work-dir }}/${{ inputs.config-file }}" >> "$GITHUB_OUTPUT"; fi shell: bash - name: Set pipe id: pipe @@ -126,7 +119,8 @@ runs: echo 'FAILONERROR=-fail-on-error' >> "$GITHUB_OUTPUT" shell: bash - name: Run gostyle - run: (go vet -vettool=`which gostyle` ${{ steps.flags.outputs.FLAGS }} ${{ steps.package.outputs.PACKAGE }} ${{ steps.failonerror.outputs.FAILONERROR }}) ${{ steps.pipe.outputs.PIPE }} ${{ steps.reviewdog-failonerror.outputs.FAILONERROR }} + run: (go vet -vettool=`which gostyle` ${{ steps.flags.outputs.FLAGS }} ${{ inputs.go-package }} ${{ steps.failonerror.outputs.FAILONERROR }}) ${{ steps.pipe.outputs.PIPE }} ${{ steps.reviewdog-failonerror.outputs.FAILONERROR }} shell: bash + working-directory: ${{ inputs.work-dir }} env: REVIEWDOG_GITHUB_API_TOKEN: ${{ inputs.github-token }}