diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-29 17:23:33 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-29 17:23:33 +0300 |
| commit | 97a74a4e925277e3f248f7b06515a3ca17337944 (patch) | |
| tree | 6eb02cc4fb8d3ebfe30f30e844ef7620059620cf | |
| parent | ad9ef7be2853679515c989cb8c890502e68cbffb (diff) | |
ci(yq): pin golangci-lint and gate lint on new issues
| -rw-r--r-- | .github/workflows/ci.yml | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c11904..bc83bbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 @@ -21,13 +23,28 @@ jobs: run: | echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" go install github.com/magefile/mage@v1.15.0 - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8 - name: Gate vet run: mage vet - name: Gate lint - run: mage lint + env: + PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} + PUSH_BEFORE_SHA: ${{ github.event.before }} + run: | + BASE_SHA="${PR_BASE_SHA:-$PUSH_BEFORE_SHA}" + + if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then + if git rev-parse HEAD^ >/dev/null 2>&1; then + BASE_SHA="$(git rev-parse HEAD^)" + else + BASE_SHA="$(git rev-list --max-parents=0 HEAD)" + fi + fi + + echo "Lint baseline: $BASE_SHA" + golangci-lint run --new-from-rev="$BASE_SHA" - name: Gate tests run: mage test |
