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

create PullRequest between forked repo to original #792

Closed
Chrislevi opened this issue May 16, 2018 · 4 comments
Closed

create PullRequest between forked repo to original #792

Chrislevi opened this issue May 16, 2018 · 4 comments

Comments

@Chrislevi
Copy link

is there a method to create a pull request with the original repo as the base and a forked branch as the head?

I tried this line, but it threw a 'Validation Error'
repo.create_pull("Title", "Body", '{}:{}'.format(original_repo, master), '{}:{}'.format(forked_user, feature), True)

@mfonville
Copy link
Contributor

mfonville commented May 16, 2018

I think the way you wanted this, it's not possible when reading the API at https://developer.github.com/v3/pulls/#input for the base you can only pass a branch of the repository you are creating the PR on.

So you can only do:

original_repo.create_pull("Title", "Body", '{}'.format(master), '{}:{}'.format(forked_user, feature), True)

@sfdye sfdye closed this as completed May 18, 2018
@evandrocoan
Copy link

evandrocoan commented Jan 6, 2019

Just clarifying, I tried this and ended up backwards.

From fork evandroforks to upstream tox-dev you should do:

upstream_user = github_api.get_user('tox-dev')
upstream_repo = upstream_user.get_repo('tox')

upstream_pullrequest = upstream_repo.create_pull("Title", "Body", 'master', 
          '{}:{}'.format('evandroforks', 'master'), True)

From upstream tox-dev to fork evandroforks you should do:

fork_user = github_api.get_user('evandroforks')
fork_repo = fork_user.get_repo('tox')

fork_pullrequest = fork_repo.create_pull("Title", "Body", 'master', 
          '{}:{}'.format('tox-dev', 'master'), False)

@edwardchalstrey1
Copy link

Can this issue be reopened? It would be a nice feature to have

@evandrocoan
Copy link

evandrocoan commented Feb 5, 2022

@edwardchalstrey1 , I am already using this to create pull-requests from my forks the original repositories. here is the code: https://github.com/evandrocoan/githubpullrequests/blob/61e583f2247d252633d7a17f3345acadaf707dd6/source/githubpullrequests/__init__.py#L359

This is an example pull-request created with it: evandroforks/vscode-textmate#2

Perhaps you are trying to do something else?

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

No branches or pull requests

5 participants