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

Skip merge commits #375

Merged
merged 8 commits into from Aug 15, 2023
Merged

Skip merge commits #375

merged 8 commits into from Aug 15, 2023

Conversation

korthout
Copy link
Owner

@korthout korthout commented Aug 12, 2023

Adds a new input merge_commits that specifies how the action should deal with merge commits on the merged pull request. It supports two settings:

  • fail fails the backport (default)
  • skip excludes the merge commits from the commits to cherry-pick

closes #373

Merge commits cannot be cherry-picked unless a mainline is specified. In
other to add the skip merge commit behavior as an input, we need to have
a way to remove the merge commits from the shas to cherry pick.

We can use git rev-list --merged to list the merge commits in a commit
range. Since we don't have a range but an array of commits, we can build
the shorthand for the range as the `first^..last`.
We must keep the behavior similar for users that haven't configured
to skip merge commits.

However, we can help the user by informing them why the backport failed
and what they can do to recover. Especially, nudging the user towards
the new config option to skip merge commits.
Adds the ability to configure skipping or failing merge commits. Note
that this does not yet add an input to set this configuration.
Used to set the commits.merge_commits config setting which either fails
the backport when the action encounters merge commits on the merged pull
request, or skips any merge commits when cherry-picking.

Misconfiguration fails the workflow run because this requires attention
from the workflow owner. The fail setting fails the backport as
described in the README, i.e. the action reports on its success or
failure through a comment on the merged pull request.

Perhaps in a future version I'll support failing the workflow run on
failing a backport, but for now I'll keep that out of scope.
@korthout korthout force-pushed the skipMergeCommits branch 2 times, most recently from 8faaefc to 110cfbc Compare August 15, 2023 11:27
@korthout korthout marked this pull request as ready for review August 15, 2023 11:36
@korthout korthout merged commit 37f2015 into main Aug 15, 2023
1 check passed
@korthout korthout deleted the skipMergeCommits branch August 15, 2023 11:39
This was referenced Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support skipping merge commits
1 participant