From df239b44a98fe4bac1884f06b2c811e4f158cf28 Mon Sep 17 00:00:00 2001 From: kennedy-whytech Date: Wed, 23 Apr 2025 15:03:04 -0400 Subject: [PATCH 1/2] fix(golang): workaround to handle golangci in different versions --- hooks/golang/golangci-lint-common.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hooks/golang/golangci-lint-common.sh b/hooks/golang/golangci-lint-common.sh index 876e55f..a853e36 100755 --- a/hooks/golang/golangci-lint-common.sh +++ b/hooks/golang/golangci-lint-common.sh @@ -4,13 +4,26 @@ lint_all() { ## Lets first report what version of golangi-lint is being run since it will ## not otherwise provide that information. - golangci-lint --version + version_output=$(golangci-lint --version) + echo "$version_output" + + ## Extract semver number (e.g., 1.54.2 or 2.1.2) + version=$(echo "$version_output" | grep -oP 'version \K[0-9]+\.[0-9]+\.[0-9]+') + + ## Use correct format flag depending on version + if [ "$(printf '%s\n' "$version" "1.55.0" | sort -V | head -n1)" = "1.55.0" ]; then + # version >= 1.55.0 → use --format + format_flag="--format" + else + # version < 1.55.0 → use --out-format + format_flag="--out-format" + fi golangci-lint run \ --allow-parallel-runners \ --fix \ --verbose \ - --out-format colored-line-number \ + "$format_flag" colored-line-number \ --color always \ --enable errcheck \ --enable gosimple \ From 9f4761894e2cbfc8ac94f633ac4e31e1c58714e1 Mon Sep 17 00:00:00 2001 From: kennedy-whytech Date: Wed, 23 Apr 2025 15:11:43 -0400 Subject: [PATCH 2/2] fix(gha): update to use lint-release-notes@v4 --- .github/workflows/ci.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c864b97..3c35914 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,20 +1,21 @@ name: CI on: + workflow_dispatch: {} + pull_request: {} push: + branches-ignore: + - main jobs: release-notes: name: Release notes preview runs-on: ubuntu-latest - if: github.ref != 'refs/heads/main' steps: - - uses: open-turo/actions-release/release-notes-preview@v2 + - uses: open-turo/actions-release/lint-release-notes@v4 with: github-token: ${{ secrets.GITHUB_TOKEN }} - env: - NPM_TOKEN: ${{ secrets.OPEN_TURO_NPM_TOKEN }} lint: name: Lint