Adding quick option to be able to specify a GitHub enterprise url (#80)
* adding quick option to be able to specify a GitHub enterprise url Signed-off-by: vsoch <vsoch@users.noreply.github.com> * Use GITHUB_API_URL instead Co-authored-by: Tobias <github@tobiasgabriel.de> * Update README.md * Update pull-request.py Co-authored-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: Tobias <github@tobiasgabriel.de>
This commit is contained in:
@@ -50,10 +50,10 @@ Unlike standard actions, this action just uses variables from the environment.
|
||||
| PULL_REQUEST_ASSIGNEES | A list (string with spaces) of users to assign | false | unset |
|
||||
| PULL_REQUEST_REVIEWERS | A list (string with spaces) of users to assign review | false | unset |
|
||||
| PULL_REQUEST_TEAM_REVIEWERS | A list (string with spaces) of teams to assign review | false | unset |
|
||||
| PASS_ON_ERROR | Instead of failing on an error response, pass | unset |
|
||||
| PASS_IF_EXISTS | Instead of failing if the pull request already exists, pass | unset |
|
||||
| PULL_REQUEST_UPDATE | If the pull request already exists, update it | unset |
|
||||
| PULL_REQUEST_STATE | If `PULL_REQUEST_UPDATE` is true, update to this state (open, closed) | open |
|
||||
| PASS_ON_ERROR | Instead of failing on an error response, pass | false | unset |
|
||||
| PASS_IF_EXISTS | Instead of failing if the pull request already exists, pass | false | unset |
|
||||
| PULL_REQUEST_UPDATE | If the pull request already exists, update it | false | unset |
|
||||
| PULL_REQUEST_STATE | If `PULL_REQUEST_UPDATE` is true, update to this state (open, closed) | false |open |
|
||||
|
||||
For `PULL_REQUEST_DRAFT`, `PASS_ON_ERROR`, `PASS_IF_EXISTS`, and `MAINTAINER_CANT_MODIFY`, these are
|
||||
treated as environment booleans. If they are defined in the environment, they trigger the
|
||||
|
||||
@@ -235,8 +235,7 @@ def find_pull_request(listing, source):
|
||||
|
||||
|
||||
def find_default_branch():
|
||||
"""Find default branch for a repo (only called if branch not provided)
|
||||
"""
|
||||
"""Find default branch for a repo (only called if branch not provided)"""
|
||||
response = requests.get(REPO_URL)
|
||||
|
||||
# Case 1: 404 might need a token
|
||||
@@ -283,7 +282,9 @@ def add_reviewers(entry, reviewers, team_reviewers):
|
||||
################################################################################
|
||||
|
||||
API_VERSION = "v3"
|
||||
BASE = "https://api.github.com"
|
||||
|
||||
# Allow for a GitHub enterprise URL
|
||||
BASE = os.environ.get("GITHUB_API_URL") or "https://api.github.com"
|
||||
|
||||
PR_TOKEN = os.environ.get("PULL_REQUEST_TOKEN") or get_envar("GITHUB_TOKEN")
|
||||
PR_REPO = os.environ.get("PULL_REQUEST_REPOSITORY") or get_envar("GITHUB_REPOSITORY")
|
||||
|
||||
Reference in New Issue
Block a user