derek icon indicating copy to clipboard operation
derek copied to clipboard

Backlog: check if PR template was deleted

Open alexellis opened this issue 6 years ago • 16 comments

Scenario: impatient contributor deletes whole PR template message and decides it doesn't apply to them.

Result: PR is decorated with a comment telling user to fill out PR template.

Implementation ideas:

Opt in via feature in .DEREK.yml file pr_template_checking

  • v1.0 PR body cannot be empty
  • v2.0 100% of the lines beginning with a heading i.e. # in repo/.github/PULL_REQUEST_TEMPLATE.md must be present in body of PR

@rgee0 @dirkhh @johnharris85 thoughts?

bad_pr_edi

alexellis avatar Mar 03 '18 18:03 alexellis

I’d be tempted to also have a switch to enable totally empty PRs to be automatically closed. Default would be just apply a message.

rgee0 avatar Mar 03 '18 19:03 rgee0

Ye I like the idea (and feature progression). Are you thinking same thing for issues as well?

Also what about the ability to check that a PR references an existing issue / proposal? That ties into the workflow for OpenFaaS that all PRs must have issues / proposals.

johnharris85 avatar Mar 03 '18 19:03 johnharris85

@johnharris85 the same thing could apply to issues but for an MVP I'd suggest going after PRs first. I guess this would be valuable to any project that uses a template for PRs.

The issue per PR requirement is a thing, but I think it may be hard to automate so could be revisited later.

If anyone wants to work on a solution as per v1.0 or v2.0 please comment

alexellis avatar Mar 04 '18 19:03 alexellis

I was starting to have a look at this, if nobody else is already working on it.

johnmccabe avatar Mar 04 '18 20:03 johnmccabe

I've got this working, just need to take some time to rebase and raise the PR, will try to get it raised by wednesday

johnmccabe avatar Apr 16 '18 15:04 johnmccabe

BTW, I missed this earlier... I think v2.0 is a bit too aggressive. It's fairly common for PR templates to have sections that don't really make sense for all PRs... So I'd say that "at least half of the headings need to remain" or something slightly more flexible than that. Extra credits for it being configurable :-)

dirkhh avatar Apr 16 '18 15:04 dirkhh

Bump on this issue and +1 to Dirk's comments I think that makes sense.. Some proportion of headings should be present. Certainly it will pick up the annoying fly-by PRs like:

(no text given)

Alex

alexellis avatar Jul 13 '18 14:07 alexellis

@johnharris85 would you like to take a look at this one? I also have a refactoring task that needs doing to make Derek more like an SDK / easier to run in other platforms/apps. #62 (I don't have a good way to contact you so a comment here is the best at the moment, if you'd like to join OpenFaaS Slack we have a #derek channel there)

alexellis avatar Jul 13 '18 14:07 alexellis

It seems like we have a kind of dead-lock or lack of interest for this feature. I still have to comment back to people who delete the whole text and submit a PR with no description at all. For that reason I've raised a simpler issue for v1.0 of the feature in #103

alexellis avatar Nov 10 '18 17:11 alexellis

Getting started on this now. Hoping for it to be ready for the HacktoberFest.

Please let me know if any other features or anything has come to mind since the last time this was commented on

burtonr avatar Sep 25 '19 13:09 burtonr

Did anyone work on this?

alexellis avatar Jan 02 '20 12:01 alexellis

Going back to the "Implementation ideas:", I'd suggest that we make a binary decision based upon the following criteria for “version 1.5” of this

  • A PR template is present in the repo
  • 50% of the lines beginning with # in the template are still in the PR text submitted

alexellis avatar Jan 02 '20 12:01 alexellis

A new contributor can start this with a unit test in isolation from Derek's main codebase and PR/webhook handling features, once fully working we can help with integrating it in.

alexellis avatar Jan 02 '20 12:01 alexellis

I'm getting started on this now

tchaudhry91 avatar Jan 02 '20 12:01 tchaudhry91

Version "v1.0" was completed here: https://github.com/alexellis/derek/pull/104

This change/update would be for version "v2.0" where the template is used to validate the incoming PR body.

burtonr avatar Jan 02 '20 13:01 burtonr

Aha, yes so I think we need version “1.5” and not quite a “2.0” as the original idea there might have been a bit too strict.

alexellis avatar Jan 02 '20 13:01 alexellis