Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci-lint-action failed on Push due to unable fetching commit diffs with --only-new-issues set #1039

Closed
3 tasks done
ZiqianXu opened this issue May 8, 2024 · 2 comments · Fixed by #1040
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@ZiqianXu
Copy link

ZiqianXu commented May 8, 2024

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

We noticed golangci-lint-action started to fail recently due to enable to fetch commit diffs and instead analyzing the whole repo.

The error messages are

failed to fetch push patch: RequestError [HttpError]: Not Found
...
at async prepareEnv (/home/runner/work/_actions/golangci/golangci-lint-action/v6/dist/run/index.js:89264:23) {
   status: 404,
   response: {
     url: 'https://api.github.com/repos/<owner>/<repo>/compare/76d57f3a98ce42d71b621e9f13a7e46bc5ac1443..2bca1b9[31](https://github.com/<owner>/<repo>/actions/runs/8990379623/job/24707149228#step:4:32)607717b9b69a7f52134e4f3ad64db30',
     status: 404,
...
request: {
     method: 'GET',
     url: 'https://api.github.com/repos//<owner>/<repo>/compare/76d57f3a98ce42d71b621e9f13a7e46bc5ac1443..2bca1b931607717b9b69a7f52134e4f3ad64db30',
     headers: {
       accept: 'application/vnd.github.v3.diff',
       'user-agent': 'octokit-core.js/5.0.1 Node.js/20.8.1 (linux; x64)',
       authorization: 'token [REDACTED]'
     },
     request: {
       agent: [Agent],
       fetch: [Function: proxyFetch],
       hook: [Function: bound bound register]
     }

Is that due to the change to use 2 dots instead of 3 dots in #1030 ?

Version of golangci-lint

v1.58.0

Version of the GitHub Action

v6

Workflow file

steps:
    - name: Checkout Repository
      uses: actions/checkout@v4
    - name: Setup Go
      uses: actions/setup-go@v5
      with:
        go-version: "1.22"
        check-latest: true
    - name: Setup golangci-lint
      uses: golangci/golangci-lint-action@v6
      with:
        version: v1.58.0
        args: --timeout=5m --verbose --config=golangci.yml
        # only check for new linting issues
        only-new-issues: true

Go version

go 1.22

Code example or link to a public repository

// add your code here
@ldez
Copy link
Member

ldez commented May 8, 2024

hello,

We noticed golangci-lint-action started to fail recently due to enable to fetch commit diffs and instead analyzing the whole repo.

before v5.1.0 the push was not supported with only-new-issues.

So, now, if you use only-new-issues the push will not analyze the whole repo but only the diff.

However, there is a bug with the 2-dots syntax, I will fix it.

@ldez ldez added the bug Something isn't working label May 8, 2024
@ldez ldez closed this as completed in #1040 May 8, 2024
@ZiqianXu
Copy link
Author

ZiqianXu commented May 8, 2024

Thanks for the quick fix and deployment @ldez, I can confirm the golangci-lint-action starts to get the diff patch for push event in my repo! Really appreciated your hard work on maintaining this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants