FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Always fill out PR title after conflict resolution by webknjaz · Pull Request #20 · python/cherry-picker · GitHub

Always fill out PR title after conflict resolution - #20

Open
webknjaz wants to merge 1 commit into
python:mainfrom
webknjaz:bugfixes/fill-out-pr-after-conflict-resolution
Open

Always fill out PR title after conflict resolution#20
webknjaz wants to merge 1 commit into
python:mainfrom
webknjaz:bugfixes/fill-out-pr-after-conflict-resolution

Conversation

webknjaz commented Feb 5, 2021

Copy link
Copy Markdown
Member

Before this change, cherry-picker used to loose the backported commit
message and didn't pass anything to the push_to_remote() method which
resulted in sending an API request to GitHub that had an empty title
upon resume. This caused GitHub respond with an error.

This code path was only problematic for people having a GitHub token in
their env and therefore enjoying the benefits of the PR autocreation.

After this change, cherry-picker picks up the commit message correctly
and extracts the proper PR title and body out of it.

Before this change, cherry-picker used to loose the backported commit
message and didn't pass anything to the `push_to_remote()` method which
resulted in sending an API request to GitHub that had an empty title
upon resume. This caused GitHub respond with an error.

This code path was only problematic for people having a GitHub token in
their env and therefore enjoying the benefits of the PR autocreation.

After this change, cherry-picker picks up the commit message correctly
and extracts the proper PR title and body out of it.

webknjaz commented Feb 5, 2021

Copy link
Copy Markdown
Member Author

@sivel this should fix your problem ☝️

webknjaz commented Feb 5, 2021

Copy link
Copy Markdown
Member Author

Please ignore the nightly job, its failure is unrelated to this change. It happens because pytest turns all warnings into errors.

sivel commented Feb 5, 2021

Copy link
Copy Markdown

I've confirmed this fixes my issue.

Instead of:

422
{"message":"Validation Failed","errors":[{"resource":"Issue","code":"missing_field","field":"title"}],"documentation_url":"https://docs.github.com/rest/reference/pulls#create-a-pull-request"}

The PR is properly created.

jaraco closed this Jun 3, 2021
jaraco reopened this Jun 3, 2021
return updated_commit_message

def push_to_remote(self, base_branch, head_branch, commit_message=""):
def push_to_remote(self, base_branch, head_branch, commit_message):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why is removing the default necessary?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@webknjaz can we keep the original behavior and let the default commit message?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't remember, it was over a year ago. But I think I wanted to prevent situations when a caller would accidentally leave it empty. Why would one want this behavior to be implicit? If a caller wants an empty title, they should state that explicitly instead of relying on the magical empty value. Besides, it's passed to create_gh_pr() without changes, which already enforces the same.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

FTR, I've checked that the only known consumer does not call this method directly: https://github.com/python/miss-islington/blob/23841c0b44b84981d0db055e7eb0c61a532b5aa4/miss_islington/tasks.py#L128. And there's probably no other public API user in the wild.

Having no default here is intended to force the callers to always compute the PR title as opposed to allowing it to be empty when forgotten.

ambv commented Jan 15, 2025

Copy link
Copy Markdown
Contributor

Safe to say this ain't happening. Sorry to have wasted your time, Sviatoslav.

ambv closed this Jan 15, 2025

Copy link
Copy Markdown
Member Author

It's okay, Łukasz. Ping me if that changes in the future and I'll gladly take another look!

FWIW, some of my colleagues at Ansible were hitting this corner case, hence the PR. I usually don't have a token in env vars..

Copy link
Copy Markdown
Member Author

Let's try again.

webknjaz reopened this Jan 26, 2026

encukou commented Jan 26, 2026

Copy link
Copy Markdown
Member

@ambv

Safe to say this ain't happening. Sorry to have wasted your time, Sviatoslav.

Was this just routine issue cleanup, or is the fix not worth doing?

webknjaz requested review from encukou and hugovk January 26, 2026 13:30

Copy link
Copy Markdown
Member Author

I've rebased this locally and will push everything once I add some integration tests.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL