Skip to content

Commit

Permalink
Merge pull request #25 from jpower432/feat/custom-pull-request-title
Browse files Browse the repository at this point in the history
feat: allows pull request title to be configurable
  • Loading branch information
Alex Flom authored Jul 21, 2023
2 parents 5edd331 + 9fee86d commit f141a5a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
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

0 comments on commit f141a5a

Please sign in to comment.