10 Commits
1.0.17 ... v1

Author SHA1 Message Date
vsoch
bd57348f7a Merge branch 'v1' of github.com:vsoch/pull-request-action into v1 2021-06-21 10:11:26 -06:00
vsoch
cd08d4e74c Merge branch 'master' of github.com:vsoch/pull-request-action into v1 2021-06-21 10:11:03 -06:00
Vanessasaurus
29dbfc0acd Merge pull request #75 from Kong/feat/discover-default-branch
Use repo's default branch if no branch specified
2021-06-21 10:10:40 -06:00
Danny Sauer
c0bf76830b Use repo's default branch if no branch specified 2021-06-21 11:04:52 -05:00
vsoch
a08a03a717 Merge branch 'master' of github.com:vsoch/pull-request-action into v1 2021-04-27 06:06:59 -06:00
vsoch
6e7a9cb309 Merge branch 'master' of github.com:vsoch/pull-request-action into v1 2021-04-18 19:54:39 -06:00
vsoch
fc56ed279d fixing pull-request.py to be in sync with master
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-02-15 10:54:21 -07:00
vsoch
89a865123c resolving conflicts
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-02-12 17:49:53 -07:00
vsoch
260ef70e70 updating v1 branch
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-02-12 17:49:17 -07:00
Vanessasaurus
2293747d8b making abort_if_fail more verbose (#57) (#58)
Signed-off-by: vsoch <vsochat@stanford.edu>
2020-12-18 04:07:14 -07:00

View File

@@ -234,6 +234,22 @@ def find_pull_request(listing, source):
return entry
def find_default_branch():
"""Find default branch for a repo (only called if branch not provided)
"""
response = requests.get(REPO_URL)
# Case 1: 404 might need a token
if response.status_code == 404:
response = requests.get(REPO_URL, headers=HEADERS)
if response.status_code != 200:
abort_if_fail(response, "Unable to retrieve default branch")
default_branch = response.json()["default_branch"]
print("Found default branch: %s" % default_branch)
return default_branch
def add_reviewers(entry, reviewers, team_reviewers):
"""Given regular or team reviewers, add them to a PR.
@@ -343,8 +359,8 @@ def main():
if not branch_prefix:
print("No branch prefix is set, all branches will be used.")
# Default to master to support older, will eventually change to main
pull_request_branch = os.environ.get("PULL_REQUEST_BRANCH", "master")
# Default to project default branch if none provided
pull_request_branch = os.environ.get("PULL_REQUEST_BRANCH", find_default_branch())
print("Pull requests will go to %s" % pull_request_branch)
# Pull request draft