action-semantic-pull-request icon indicating copy to clipboard operation
action-semantic-pull-request copied to clipboard

Comment on the pull request

Open kevgo opened this issue 3 years ago • 7 comments

It would be nice if this action would also add a comment to the pull request directly. Here is an example for how that could look like:

image

The message should - of course - be configurable via an input option.

Implementing this is pretty straightforward:

github.rest.issues.createComment({
  issue_number: context.issue.number,
  owner: context.repo.owner,
  repo: context.repo.repo,
  body: "Please make the title of this Pull Request follow the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format 🙏"
})

kevgo avatar Jun 29 '22 12:06 kevgo

Can this be achieved with https://github.com/amannn/action-semantic-pull-request/issues/178?

amannn avatar Jun 29 '22 12:06 amannn

I personally think providing the error as an Action Step Output is different to enabling the Action to comment the issue and a suggestion on the PR itself.

I would suggest these are separate issues, though my comment in #178 was due to the OPs Issue body seems to indicate wanting PR comments vs the Issue title requests Step output for manual composition in Actions.

I would love to see some terse error with a suggestion, like https://github.com/jef/conventional-commits-pr-action but with less text.

jthegedus avatar Jun 29 '22 14:06 jthegedus

People can definitely build their own logic to add comments using #178. But that's pretty cumbersome. I think notifying the user about incorrect formatting of their pull request is a part of the core feature set of this GitHub Action.

kevgo avatar Jun 29 '22 17:06 kevgo

As I state above, I think commenting on PRs and Action outputs are different. Can we reopen this or should I create another Issue to specifically track comments on PR feature request?

jthegedus avatar Jun 30 '22 02:06 jthegedus

To be honest I currently don't really see the value of commenting on pull requests. I'd like to keep the noise of this action to a minimum, so in case you follow the provided configuration, you shouldn't hear anything from this action. Only when things go wrong there should be an error message and I think checks work really well for that. Having a comment repeat what a check already provides doesn't seem useful to me.

However, with https://github.com/amannn/action-semantic-pull-request/issues/178 you could build such a workflow yourself if you have a use case where this makes more sense. I saw there are actions like https://github.com/marketplace/actions/comment-pull-request which might help to redirect the output to a PR comment.

amannn avatar Jun 30 '22 07:06 amannn

Having a comment repeat what a check already provides doesn't seem useful to me.

I disagree. Seeing that the check failed does not tell you why it failed. You have to click through via the "details" link to see the Action execution details. From my experience on asdf, no external contributors understand that this check failed or why, no one clicks through, and the maintainers have to resolve semantic-pr issues. Contributors are more likely to respond to comments on their PRs than the checks themselves. The education piece is missing.

Not to mention this could be opt-in, so it's only noisy for those who want the noise. I want the noise to stop me having to make noise manually.

jthegedus avatar Jun 30 '22 08:06 jthegedus

At our project, many non-developers use GitHub pull requests to manage things like blog posts or job postings. Most of these users are not comfortable clicking on a broken CI status and sifting through very technical steps and their console output.

I think getting a friendly comment on a pull request that explains in plain English (or French|Spanish|Chinese) what exactly the problem is and links to further documentation is a lot more user friendly for these people than the current behavior.

I think it would be completely okay if this feature is disabled by default. This GitHub Action doesn't even need to provide a default text. All that is needed from my perspective is a string input parameter that when set posts the given text as a comment on the pull request.

kevgo avatar Jun 30 '22 20:06 kevgo