Update input defaults
This commit is contained in:
parent
bdadb3b4a0
commit
b11cb71e96
4 changed files with 42 additions and 28 deletions
21
dist/src/create_pull_request.py
vendored
21
dist/src/create_pull_request.py
vendored
|
@ -15,6 +15,13 @@ DEFAULT_COMMITTER = "GitHub <noreply@github.com>"
|
|||
DEFAULT_AUTHOR = (
|
||||
"github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
|
||||
)
|
||||
DEFAULT_COMMIT_MESSAGE = "[create-pull-request] automated change"
|
||||
DEFAULT_TITLE = "Changes by create-pull-request action"
|
||||
DEFAULT_BODY = (
|
||||
"Automated changes by "
|
||||
+ "[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action"
|
||||
)
|
||||
DEFAULT_BRANCH = "create-pull-request/patch"
|
||||
|
||||
|
||||
def get_git_config_value(repo, name):
|
||||
|
@ -89,10 +96,8 @@ def set_committer_author(repo, committer, author):
|
|||
github_token = os.environ["GITHUB_TOKEN"]
|
||||
github_repository = os.environ["GITHUB_REPOSITORY"]
|
||||
# Get environment variables with defaults
|
||||
branch = os.getenv("CPR_BRANCH", "create-pull-request/patch")
|
||||
commit_message = os.getenv(
|
||||
"CPR_COMMIT_MESSAGE", "Changes by create-pull-request action"
|
||||
)
|
||||
branch = os.getenv("CPR_BRANCH", DEFAULT_BRANCH)
|
||||
commit_message = os.getenv("CPR_COMMIT_MESSAGE", DEFAULT_COMMIT_MESSAGE)
|
||||
# Get environment variables with a default of 'None'
|
||||
committer = os.environ.get("CPR_COMMITTER")
|
||||
author = os.environ.get("CPR_AUTHOR")
|
||||
|
@ -178,12 +183,8 @@ if result["action"] in ["created", "updated"]:
|
|||
sys.exit()
|
||||
|
||||
# Fetch optional environment variables with default values
|
||||
title = os.getenv("CPR_TITLE", "Auto-generated by create-pull-request action")
|
||||
body = os.getenv(
|
||||
"CPR_BODY",
|
||||
"Auto-generated pull request by "
|
||||
"[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub Action",
|
||||
)
|
||||
title = os.getenv("CPR_TITLE", DEFAULT_TITLE)
|
||||
body = os.getenv("CPR_BODY", DEFAULT_BODY)
|
||||
|
||||
# Create or update the pull request
|
||||
coupr.create_or_update_pull_request(
|
||||
|
|
14
dist/src/test_create_or_update_branch.py
vendored
14
dist/src/test_create_or_update_branch.py
vendored
|
@ -30,7 +30,7 @@ DEFAULT_BRANCH = "tests/master"
|
|||
NOT_BASE_BRANCH = "tests/branch-that-is-not-the-base"
|
||||
NOT_EXIST_BRANCH = "tests/branch-that-does-not-exist"
|
||||
|
||||
COMMIT_MESSAGE = "Changes by create-pull-request action"
|
||||
COMMIT_MESSAGE = "[create-pull-request] automated change"
|
||||
BRANCH = "tests/create-pull-request/patch"
|
||||
BASE = DEFAULT_BRANCH
|
||||
|
||||
|
@ -730,7 +730,9 @@ test_coub_commits_on_base_no_diff = coub_commits_on_base_no_diff
|
|||
|
||||
test_coub_commits_on_working_base = coub_commits_on_working_base
|
||||
test_coub_changes_and_commits_on_working_base = coub_changes_and_commits_on_working_base
|
||||
test_coub_changes_and_commits_on_base_and_working_base = coub_changes_and_commits_on_base_and_working_base
|
||||
test_coub_changes_and_commits_on_base_and_working_base = (
|
||||
coub_changes_and_commits_on_base_and_working_base
|
||||
)
|
||||
|
||||
# WBNB
|
||||
test_coub_wbnb_no_changes_on_create = coub_wbnb_no_changes_on_create
|
||||
|
@ -743,5 +745,9 @@ test_coub_wbnb_changes_no_diff = coub_wbnb_changes_no_diff
|
|||
test_coub_wbnb_commits_on_base_no_diff = coub_wbnb_commits_on_base_no_diff
|
||||
|
||||
test_coub_wbnb_commits_on_working_base = coub_wbnb_commits_on_working_base
|
||||
test_coub_wbnb_changes_and_commits_on_working_base = coub_wbnb_changes_and_commits_on_working_base
|
||||
test_coub_wbnb_changes_and_commits_on_base_and_working_base = coub_wbnb_changes_and_commits_on_base_and_working_base
|
||||
test_coub_wbnb_changes_and_commits_on_working_base = (
|
||||
coub_wbnb_changes_and_commits_on_working_base
|
||||
)
|
||||
test_coub_wbnb_changes_and_commits_on_base_and_working_base = (
|
||||
coub_wbnb_changes_and_commits_on_base_and_working_base
|
||||
)
|
||||
|
|
|
@ -15,6 +15,13 @@ DEFAULT_COMMITTER = "GitHub <noreply@github.com>"
|
|||
DEFAULT_AUTHOR = (
|
||||
"github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
|
||||
)
|
||||
DEFAULT_COMMIT_MESSAGE = "[create-pull-request] automated change"
|
||||
DEFAULT_TITLE = "Changes by create-pull-request action"
|
||||
DEFAULT_BODY = (
|
||||
"Automated changes by "
|
||||
+ "[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action"
|
||||
)
|
||||
DEFAULT_BRANCH = "create-pull-request/patch"
|
||||
|
||||
|
||||
def get_git_config_value(repo, name):
|
||||
|
@ -89,10 +96,8 @@ def set_committer_author(repo, committer, author):
|
|||
github_token = os.environ["GITHUB_TOKEN"]
|
||||
github_repository = os.environ["GITHUB_REPOSITORY"]
|
||||
# Get environment variables with defaults
|
||||
branch = os.getenv("CPR_BRANCH", "create-pull-request/patch")
|
||||
commit_message = os.getenv(
|
||||
"CPR_COMMIT_MESSAGE", "Changes by create-pull-request action"
|
||||
)
|
||||
branch = os.getenv("CPR_BRANCH", DEFAULT_BRANCH)
|
||||
commit_message = os.getenv("CPR_COMMIT_MESSAGE", DEFAULT_COMMIT_MESSAGE)
|
||||
# Get environment variables with a default of 'None'
|
||||
committer = os.environ.get("CPR_COMMITTER")
|
||||
author = os.environ.get("CPR_AUTHOR")
|
||||
|
@ -178,12 +183,8 @@ if result["action"] in ["created", "updated"]:
|
|||
sys.exit()
|
||||
|
||||
# Fetch optional environment variables with default values
|
||||
title = os.getenv("CPR_TITLE", "Auto-generated by create-pull-request action")
|
||||
body = os.getenv(
|
||||
"CPR_BODY",
|
||||
"Auto-generated pull request by "
|
||||
"[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub Action",
|
||||
)
|
||||
title = os.getenv("CPR_TITLE", DEFAULT_TITLE)
|
||||
body = os.getenv("CPR_BODY", DEFAULT_BODY)
|
||||
|
||||
# Create or update the pull request
|
||||
coupr.create_or_update_pull_request(
|
||||
|
|
|
@ -30,7 +30,7 @@ DEFAULT_BRANCH = "tests/master"
|
|||
NOT_BASE_BRANCH = "tests/branch-that-is-not-the-base"
|
||||
NOT_EXIST_BRANCH = "tests/branch-that-does-not-exist"
|
||||
|
||||
COMMIT_MESSAGE = "Changes by create-pull-request action"
|
||||
COMMIT_MESSAGE = "[create-pull-request] automated change"
|
||||
BRANCH = "tests/create-pull-request/patch"
|
||||
BASE = DEFAULT_BRANCH
|
||||
|
||||
|
@ -730,7 +730,9 @@ test_coub_commits_on_base_no_diff = coub_commits_on_base_no_diff
|
|||
|
||||
test_coub_commits_on_working_base = coub_commits_on_working_base
|
||||
test_coub_changes_and_commits_on_working_base = coub_changes_and_commits_on_working_base
|
||||
test_coub_changes_and_commits_on_base_and_working_base = coub_changes_and_commits_on_base_and_working_base
|
||||
test_coub_changes_and_commits_on_base_and_working_base = (
|
||||
coub_changes_and_commits_on_base_and_working_base
|
||||
)
|
||||
|
||||
# WBNB
|
||||
test_coub_wbnb_no_changes_on_create = coub_wbnb_no_changes_on_create
|
||||
|
@ -743,5 +745,9 @@ test_coub_wbnb_changes_no_diff = coub_wbnb_changes_no_diff
|
|||
test_coub_wbnb_commits_on_base_no_diff = coub_wbnb_commits_on_base_no_diff
|
||||
|
||||
test_coub_wbnb_commits_on_working_base = coub_wbnb_commits_on_working_base
|
||||
test_coub_wbnb_changes_and_commits_on_working_base = coub_wbnb_changes_and_commits_on_working_base
|
||||
test_coub_wbnb_changes_and_commits_on_base_and_working_base = coub_wbnb_changes_and_commits_on_base_and_working_base
|
||||
test_coub_wbnb_changes_and_commits_on_working_base = (
|
||||
coub_wbnb_changes_and_commits_on_working_base
|
||||
)
|
||||
test_coub_wbnb_changes_and_commits_on_base_and_working_base = (
|
||||
coub_wbnb_changes_and_commits_on_base_and_working_base
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue