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

Feature: Suggest a corrected PR title if determinable? #367

Open
JoshuaKGoldberg opened this issue May 20, 2023 · 2 comments
Open

Feature: Suggest a corrected PR title if determinable? #367

JoshuaKGoldberg opened this issue May 20, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@JoshuaKGoldberg
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Sometimes users create PRs with titles that almost match the conventional commit title. They'll do something like Feature: Abc Def instead of feat: abc def. Then they get confused by the complaint/error asking them to match the spec.

Describe the solution you'd like

For PR titles that match a known set of common mistakes such as that one, could we suggest the fix for them? Mocking up messaging:

It looks like this PR's title could be edited to:

feat: abc def

Describe alternatives you've considered

I suppose we could do it for them? But that's a bit more work. And I do want users to know to add correct PR titles in the first place...

@JoshuaKGoldberg JoshuaKGoldberg added the enhancement New feature or request label May 20, 2023
@mtfoley
Copy link
Owner

mtfoley commented Aug 23, 2023

To blow this out of proportion...

I saw a while back @bdougie had done a write up of commit message suggestions generated by AI (aicommits by @Nutlope). The package appears to have an optional to generate conventional commit messages, so it could be cool to do something with that:

https://dev.to/bdougieyo/ai-generated-git-commit-messages-4j7g
https://github.com/Nutlope/aicommits

The package is tooled as a CLI, so I'm not 100% how to use that with NCC-compiled things like this action. Also, there are some cases of mixed messaging that could come about, e.g. if you have a template for PR messages and at the same time, you kick back a generated suggestion that may have nothing to do with the template. Could be a feature issue worth filing on that repo 🤷

And back down to what you mention here...
I think we could reuse a combination of techniques to piggy back the conventional commit parsing since it's got some pretty specific error messages - if they correctly specified a "subject" (e.g. "Feature: my nice things" yields subject=Feature, and the subject is in a dictionary of likely cases, say something useful), and then if there isn't a "subject" detected, try to compare the first word in the line to the same dictionary, provide a similarly helpful message.

@JoshuaKGoldberg
Copy link
Contributor Author

Yeah I'm very hesitant to onboard AI in repository automation because of its nondeterminism:

  • Even with very good safeguards to prevent vulgarity, it's a little risky
    • This concern is going to be less and less relevant over the years as AI improves, but AI is still new enough that I think the concern is pressing
  • It's harder to debug when things go wrong, especially in the context of preventing them a next time

My preference would be to find or create a package that suggests a conventional commit name when given a non-conventional name based only on a set of rough heuristics. Being able to plug in an AI model would be a really nifty followup IMO.

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

No branches or pull requests

2 participants