template-oss icon indicating copy to clipboard operation
template-oss copied to clipboard

pull request action should surface appropriate merge strategy

Open lukekarrys opened this issue 3 years ago • 4 comments

Problem:

We want to allow only squash OR rebase as valid PR merge strategies (ref: #98). Which one is appropriate depends on context, but can't be enforced automatically.

Solution:

workflows/pull-request.yml should leave a bot comment on the PR saying something like This PR should be merged via <MERGE_STRATEGY> based on the following logic:

if (commits.length > 1 && all are conventional && none are fixups)
  rebase
else if (commits.length > 1 && (some are fixups || some are not conventional))
  squash
else
 do nothing

lukekarrys avatar Mar 17 '22 19:03 lukekarrys

it'd be swell if we could change the state of the button directly.. i wonder if the github api lets us do that

nlf avatar Mar 17 '22 19:03 nlf

from what i could find, the answer is no. or at least not yet (https://github.community/t/squash-and-merge-as-default-pull-request-merge-option/1031/38)

lukekarrys avatar Mar 17 '22 19:03 lukekarrys

Just a side comment... should we be using --fixup, --amend, or refactor: for feedback commits? I'm thinking usually an amend/fixup, but a refactor if it is significant.

fritzy avatar Apr 27 '22 17:04 fritzy

Fixup only works if you're going to be squashing the PR, unfortunately. Github PR squash-merge doesn't account for them.

wraithgar avatar Apr 28 '22 16:04 wraithgar