Skip to content

Commit

Permalink
what...?
Browse files Browse the repository at this point in the history
  • Loading branch information
sesheffield committed Jul 25, 2024
1 parent f89b54d commit 7f4f9e7
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
Expand All @@ -24,24 +24,44 @@ jobs:
*.go
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done

- name: Load Version
id: load-version
- name: Prepare Lint Args
id: prepare-lint-args
run: |
echo "GOLANGCI_VERSION=v$(cat .golangci-version)"
# Extract changed Go files and format them for golangci-lint
changed_files="${{ steps.changed-files.outputs.all_changed_files }}"
if [ -z "$changed_files" ]; then
echo "No Go files changed, skipping golangci-lint."
exit 0
fi
echo "Changed Go files:"
echo "$changed_files"
# Prepare arguments for golangci-lint
lint_args=$(echo "$changed_files" | tr '\n' ' ')
echo "lint_args=$lint_args" >> $GITHUB_ENV
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ steps.load-version.outputs.GOLANGCI_VERSION }}
args: --timeout 30m --verbose --allow-parallel-runners --max-same-issues 0 --max-issues-per-linter 0
args: --timeout 30m --verbose --allow-parallel-runners --max-same-issues 0 --max-issues-per-linter 0 ${{ env.lint_args }}
working-directory: ${{ github.workspace }}
if: |
contains(steps.changed-files.outputs.all_changed_files, '.go')
# - name: Load Version
# id: load-version
# run: |
# echo "GOLANGCI_VERSION=v$(cat .golangci-version)"
#
# - name: golangci-lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: ${{ steps.load-version.outputs.GOLANGCI_VERSION }}
# args: --timeout 30m --verbose --allow-parallel-runners --max-same-issues 0 --max-issues-per-linter 0
# working-directory: ${{ github.workspace }}
# if: |
# contains(steps.changed-files.outputs.all_changed_files, '.go')

0 comments on commit 7f4f9e7

Please sign in to comment.