Skip to content

Commit

Permalink
fix: golangci-lint-action working directory bug (#14387)
Browse files Browse the repository at this point in the history
  • Loading branch information
momentmaker authored Sep 11, 2024
1 parent 070b272 commit cd72f93
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ inputs:
required: true
go-directory:
description: Go directory to run commands from
# XXX: Don't use `.` here due to issues with the golangci-lint-action.
default: ""
default: "."
# setup-go inputs
only-modules:
description: Set to 'true' to only cache modules
Expand Down Expand Up @@ -54,13 +53,23 @@ runs:
working-directory: ${{ inputs.go-directory }}
shell: bash
run: go build ./...
- name: Set golangci-lint working directory
shell: bash
id: set-working-directory
# XXX: Don't use `.` default working directory here due to issues with the golangci-lint-action.
run: |
if [ "${{ inputs.go-directory }}" == "." ]; then
echo "golangci-lint-working-directory=" | tee -a $GITHUB_OUTPUT
else
echo "golangci-lint-working-directory=${{ inputs.go-directory }}" | tee -a $GITHUB_OUTPUT
fi
- name: golangci-lint
uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 # v5.3.0
with:
version: v1.60.3
only-new-issues: true
args: --out-format colored-line-number,checkstyle:golangci-lint-report.xml
working-directory: ${{ inputs.go-directory }}
working-directory: ${{ steps.set-working-directory.outputs.golangci-lint-working-directory }}
- name: Print lint report artifact
if: failure()
shell: bash
Expand Down

0 comments on commit cd72f93

Please sign in to comment.