Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allows pull request title to be configurable #25

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ inputs:
description: Commit message
required: false
default: "Sync automatic updates"
pull_request_title:
description: Custom pull request title
required: false
default: "Automatic updates from trestlebot"
branch:
description: Name of the Git branch to which modifications should be pushed. Required if Action is used on the `pull_request` event.
required: false
Expand Down
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ command="python3.8 -m trestlebot \
--oscal-model=\"${INPUT_OSCAL_MODEL}\" \
--ssp-index-path=\"${INPUT_SSP_INDEX_PATH}\" \
--commit-message=\"${INPUT_COMMIT_MESSAGE}\" \
--pull-request-title=\"${INPUT_PULL_REQUEST_TITLE}\" \
--branch=\"${INPUT_BRANCH}\" \
--file-patterns=\"${INPUT_FILE_PATTERN}\" \
--committer-name=\"${INPUT_COMMIT_USER_NAME}\" \
Expand Down
7 changes: 6 additions & 1 deletion trestlebot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def run(
git_provider: Optional[GitProvider] = None,
pre_tasks: Optional[List[TaskBase]] = None,
target_branch: str = "",
pull_request_title: str = "Automatic updates from bot",
check_only: bool = False,
dry_run: bool = False,
) -> str:
Expand All @@ -101,11 +102,15 @@ def run(
branch: Branch to put updates to
commit_name: Name of the user for commit creation
commit_email: Email of the user for commit creation
commit_message: Customized commit message
author_name: Name of the commit author
author_email: Email of the commit author
patterns: List of file patterns for `git add`
git_provider: Optional configured git provider for interacting with the API
pre_tasks: Optional task list to executing before updating the workspace
target_branch: Optional target or base branch for submitted pull request
pull_request_title: Optional customized pull request title
check_only: Optional heck if the repo is dirty. Fail if true.
dry_run: Only complete local work. Do not push.

Returns:
Expand Down Expand Up @@ -173,7 +178,7 @@ def run(
repo_name=repo_name,
head_branch=branch,
base_branch=target_branch,
title="Automatic updates from trestlebot",
title=pull_request_title,
body="",
)

Expand Down
8 changes: 8 additions & 0 deletions trestlebot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ def _parse_cli_arguments() -> argparse.Namespace:
default="chore: automatic updates",
help="Commit message for automated updates",
)
parser.add_argument(
"--pull-request-title",
type=str,
required=False,
default="Automatic updates from trestlebot",
help="Customized title for submitted pull requests",
)
parser.add_argument(
"--committer-name",
type=str,
Expand Down Expand Up @@ -253,6 +260,7 @@ def run() -> None:
patterns=comma_sep_to_list(args.file_patterns),
git_provider=git_provider,
target_branch=args.target_branch,
pull_request_title=args.pull_request_title,
check_only=args.check_only,
)

Expand Down