Skip to content

Commit

Permalink
Fix work-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Sep 19, 2023
1 parent a80772f commit 841692b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 }}

0 comments on commit 841692b

Please sign in to comment.