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 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 \