forked from cclauss/GitHub-web-plus-app-workflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
Here is a workflow for forking, then creating a pull request from within python. Requires PyGitHub | ||
``` | ||
Here is a workflow making use of [pygithub](https://github.com/PyGitHub/PyGithub.git) | ||
|
||
1) Create new repo: | ||
|
||
```python | ||
from github import Github | ||
g = Github(user,pass) | ||
u = g.get_user() | ||
g = Github(user,pass) #or, g=Github(token) where token is personal Oauth token | ||
u= g.get_user() | ||
u.create_repo('new_repo') | ||
``` | ||
|
||
or, to Fork an existing repo | ||
|
||
```python | ||
other_repo = g.get_repo('cclauss/GitHub-web-plus-app-workflow') | ||
mine = other_repo.fork() | ||
# now modify something | ||
other_repo.create_pull(title='test pull, feel free to ignore',body='Here is an alternate method, using pygithub', base='master',head='jsbain:master') | ||
mine=u.fork_repo(other_repo) | ||
``` | ||
|
||
Create a pull request (after using stash to push to your own github) | ||
```python | ||
# call create_pull on the repo you want to pull INTO. base = name of branch in that repo. head = name of YOUR repo, as user:branch | ||
other_repo.create_pull(title='A web-free example, using only python', | ||
body='here is a simple example using pygithub to fork a repo, then create a pull request', | ||
base='master', | ||
head='jsbain:master') | ||
``` | ||
|