Skip to content

Commit

Permalink
werid
Browse files Browse the repository at this point in the history
  • Loading branch information
sesheffield committed Jul 25, 2024
1 parent c9d1087 commit 157baba
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,26 @@ jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
run: |
# Fetch the full history to ensure we can compare commits
git fetch --prune --unshallow
# List changed files in the last commit
changed_files=$(git diff --name-only HEAD^ HEAD | grep '\.go$')
echo "Changed Go files:"
echo "$changed_files"
# Set the changed files as an output
echo "changed_go_files=$changed_files" >> $GITHUB_ENV
echo "::set-output name=changed_go_files::$changed_files"
uses: tj-actions/changed-files@v44
with:
files: |
**/*.go
- name: List all changed files
run: |
for file in ${{ env.changed_go_files }}; do
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Prepare Lint Args
id: prepare-lint-args
run: |
changed_files="${{ env.changed_go_files }}"
# 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
Expand All @@ -55,7 +50,7 @@ jobs:
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(env.changed_go_files, '.go')
contains(steps.changed-files.outputs.all_changed_files, '.go')
# - name: Load Version
# id: load-version
Expand Down

0 comments on commit 157baba

Please sign in to comment.