Skip to content

Patch cannot be determined when only-new-issues: true and push tag #1246

Open
@fredbi

Description

@fredbi

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

Good morning

I am pushing a tag to cut a release:

git tag v0.32.1
git push origin v0.32.1

The lint job fires on CI and attempts to determine the changes.

The action retrieves a wrong "before" commit from the github context
here.

The before SHA posted to the github API is 0.

failed to fetch push patch: RequestError [HttpError]: Not Found - https://docs.github.com/rest/commits/commits#compare-two-commits
  Prepared env in 809ms
      at /home/runner/work/_actions/golangci/golangci-lint-action/v7/dist/run/index.js:44487:21
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async requestWithGraphqlErrorHandling (/home/runner/work/_actions/golangci/golangci-lint-action/v7/dist/run/index.js:44213:20)
      at async Job.doExecute (/home/runner/work/_actions/golangci/golangci-lint-action/v7/dist/run/index.js:53330:18) {
    status: 404,
    response: {
      url: 'https://api.github.com/repos/go-swagger/go-swagger/compare/0000000000000000000000000000000000000000...aece8f0e60b8195764c9c42fb615d82c42a19cd8',
      status: 404,
      headers: {

Now golangci-lint runs like:

golangci-lint run --new-from-rev 0

and spews out older linting issues that have remained there for some time.

This is related to, but different from #996

CI output: https://github.com/go-swagger/go-swagger/actions/runs/15530304923/job/43717653580

I might be related to this report about the behavior of the github context: https://github.com/orgs/community/discussions/116616

Version of golangci-lint

v2.6.1

Version of the GitHub Action

v7

Workflow file

https://github.com/go-swagger/go-swagger/blob/master/.github/workflows/test.yaml

on:
  push:
    tags:
      - v*
    branches:
      - master
    paths-ignore:
      - docs/*
      - hack/hugo/*
      - .github/workflows/update-doc.yaml

permissions:
  contents: write
  pull-requests: read

jobs:
  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: stable
          check-latest: true
          cache: true
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v7
        with:
          args: --verbose
          only-new-issues: true
          skip-cache: true
          version: latest

Golangci-lint configuration

https://github.com/go-swagger/go-swagger/blob/master/.golangci.yml

Go version

1.24.4

Code example or link to a public repository

https://github.com/go-swagger/go-swagger

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions