Skip to content

Instantly share code, notes, and snippets.

@Jc2k
Created July 19, 2014 10:16
Show Gist options
  • Save Jc2k/f5dce6d0e460e6295ef7 to your computer and use it in GitHub Desktop.
Save Jc2k/f5dce6d0e460e6295ef7 to your computer and use it in GitHub Desktop.
Crappy API invocation to turn a ticket into a pull request (in python)
import requests
import json
issue = 104
branch = "BRANCH_TO_MERGE"
username = "USERNAME"
repo = "REPO"
url = "https://api.github.com/repos/%(username)s/%(repo)s/pulls" % locals()
headers = {"Authorization": "token SOMETOKEN"}
requests.post(url, headers=headers, data=json.dumps({
"issue": str(issue),
"head": "%s:%s" % (username, branch),
"base": "master",
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment