golangci / golangci-lint-action

Official GitHub Action for golangci-lint from its authors
https://github.com/marketplace/actions/golangci-lint
MIT License
1.1k stars 152 forks source link

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

Closed akshatagarwl closed 5 months ago

akshatagarwl commented 5 months ago

Welcome

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:

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: https://github.com/golangci/golangci-lint-action/pull/1059

ldez commented 5 months ago

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:


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

akshatagarwl commented 5 months ago

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