golangci/golangci-lint-action

golangci-lint unable to determine parent patch on PR create so incorrectly fails with `only-new-issues: true`

Closed this issue · 2 comments

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

when i push to a new branch and create a pr i get error in my lint action:

      at async requestWithGraphqlErrorHandling (/home/runner/work/_actions/golangci/golangci-lint-action/v8/dist/run/index.js:44213:20)
      at async Job.doExecute (/home/runner/work/_actions/golangci/golangci-lint-action/v8/dist/run/index.js:53330:18) {
  only new issues on push: 
  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint config path] in [/home/runner/work/api/api] ...
    status: 404,
    response: {
      url: 'https://api.github.com/repos/GetClaimClam/api/compare/0000000000000000000000000000000000000000...136de5f73e66e9a3c433515e3ce2022b9ebddc45',

seems like the lint action is not properly getting the parent commit so it's returning old issues. any gives?

Version of golangci-lint

v2.1.6

Version of the GitHub Action

v8

Workflow file

permissions:
  id-token: write
  contents: read
  pull-requests: write
 lint:
    runs-on: ubuntu-latest
    needs: [proto]
    if: github.event_name == 'push'
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Download generated code
        uses: actions/download-artifact@v4
        with:
          name: generated-proto-code
          path: gen/
      - uses: actions/setup-go@v5
        with:
          go-version: "1.24" # Match local development version
          cache: true
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v8
        with:
          version: latest
          only-new-issues: true
          github-token: ${{ secrets.GITHUB_TOKEN }}```

</details>

### Golangci-lint configuration

<details>

```yml
version: "2"

run:
  timeout: 5m

formatters:
  enable:
    - goimports
    - gofmt
  exclusions:
    generated: lax

linters:
  enable:
    - errcheck
    - govet
    - ineffassign
    - staticcheck
    - unused
    - revive
  exclusions:
    generated: lax

Go version

1.24.4

Code example or link to a public repository

n/a

on subsequent pushes to the PR lint works correctly

run golangci-lint
  only new issues on push: /tmp/tmp-2065-qkrKRso7vBdM/push.patch
  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint config path] in [/home/runner/work/api/api] ...
  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint config verify] in [/home/runner/work/api/api] ...
  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint run --new-from-patch=/tmp/tmp-2065-qkrKRso7vBdM/push.patch --new=false --new-from-rev= --new-from-merge-base=] in [/home/runner/work/api/api] ...
  0 issues.
ldez commented

duplicate of #996