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

support pull_request_review event type for only-new-issues #1060

Closed
2 tasks done
akshatagarwl opened this issue Jun 9, 2024 · 2 comments
Closed
2 tasks done

support pull_request_review event type for only-new-issues #1060

akshatagarwl opened this issue Jun 9, 2024 · 2 comments
Labels

Comments

@akshatagarwl
Copy link

akshatagarwl commented Jun 9, 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.

Your feature request related to a problem? Please describe.

Currently the only-new-issues only supports a few event types like pull_request, pull_request_target, push, merge_group.
The pull_request_review event is sometimes used to trigger CI only when the pull request is approved (using with types: submitted).
This comes with a few benefits:

  • prevent any malicious code from triggering your GItHub Actions
  • cuts down the total billable minutes (since you're only running lints on pull request approvals and not on every update to the PR)

Describe the solution you'd like.

support the pull_request_review type (could be confined to a few types like submitted, edited etc)

Additional context.

ref: #1059

@ldez
Copy link
Member

ldez commented Jun 9, 2024

Golangci-lint is already triggered when a PR is created or updated.

Documentation about pull_request_review event.


  • prevent any malicious code from triggering your GitHub Actions

This should be handled inside the GitHub repository configuration.
https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks


  • cuts down the total billable minutes (since you're only running lints on pull request approvals and not on every update to the PR)

This only applies to private repositories so your first argument doesn't fit.
Anyway, pull_request_review is not for approval but for reviews.

Even if you restrict only on approval (i.e. submitted + if: github.event.review.state == 'APPROVED'), this means you will approve a PR without having the result of the linting, this doesn't make sense.

If you think of another activity type (ex: edited), it's the same thing but worse.

To cut down the total billable minutes:

  • run golangci-lint locally before a push (and before a commit), the cache will do the job.
  • don't push half-done work

You want to launch golangci-lint on demand but your proposal (pull_request_review) is a bad approach.

@ldez ldez added the declined label Jun 9, 2024
@ldez ldez closed this as completed Jun 9, 2024
@akshatagarwl
Copy link
Author

You want to launch golangci-lint on demand but your proposal (pull_request_review) is a bad approach.

@ldez Would love to hear any alternatives you have in mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants