diff --git a/README.md b/README.md index 7d336e6..8cb466b 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ You will receive a pull request within your repository if there are some changes | source_repo_path | Repository path of the template | `true` | | | upstream_branch | The target branch | `true` | `main` | | source_repo_ssh_private_key | `[optional]` private ssh key for the source repository. E.q. useful if using a private template repository. [see](#private-template-repository)| `false` | | +| pr_branch_name_prefix | `[optional]` the prefix of branches created by this action | `false` | `chore/template_sync` | +| pr_title | `[optional]` the title of PRs opened by this action. Must be already created. | `false` | `upstream merge template repository` | | pr_labels | `[optional]` comma separated list. [pull request labels][pr-labels]. Must be already created. | `false` | `chore,template_sync` | | hostname | `[optional]` the hostname of the repository | `false` | `github.com` | diff --git a/action.yml b/action.yml index ae62b83..5f37ff6 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,12 @@ inputs: default: 'main' source_repo_ssh_private_key: description: '[optional] private ssh key for the source repository. E.q. useful if using a private template repository.' + pr_branch_name_prefix: + description: '[optional] the prefix of branches created by this action' + default: 'chore/template_sync' + pr_title: + description: '[optional] the title of PRs opened by this action' + default: 'upstream merge template repository' pr_labels: description: '[optional] comma separated list of pull request labels' default: 'chore,template-sync' @@ -31,5 +37,7 @@ runs: SOURCE_REPO_PATH: ${{ inputs.source_repo_path }} UPSTREAM_BRANCH: ${{ inputs.upstream_branch }} SSH_PRIVATE_KEY_SRC: ${{ inputs.source_repo_ssh_private_key }} + PR_BRANCH_NAME_PREFIX: ${{ inputs.pr_branch_name_prefix }} + PR_TITLE: ${{ inputs.pr_title }} PR_LABELS: ${{ inputs.pr_labels }} HOSTNAME: ${{ inputs.hostname }} diff --git a/src/sync_template.sh b/src/sync_template.sh index 463bc24..6c23d49 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -32,7 +32,7 @@ TEMPLATE_VERSION_FILE_NAME=".templateversionrc" TEMPLATE_SYNC_IGNORE_FILE_NAME=".templatesyncignore" TEMPLATE_REMOTE_GIT_HASH=$(git ls-remote "${SOURCE_REPO}" HEAD | awk '{print $1}') NEW_TEMPLATE_GIT_HASH=$(git rev-parse --short "${TEMPLATE_REMOTE_GIT_HASH}") -NEW_BRANCH="chore/template_sync_${NEW_TEMPLATE_GIT_HASH}" +NEW_BRANCH="${PR_BRANCH_NAME_PREFIX}_${NEW_TEMPLATE_GIT_HASH}" echo "::group::Check new changes" echo "::debug::new Git HASH ${NEW_TEMPLATE_GIT_HASH}" @@ -85,7 +85,7 @@ echo "::endgroup::" echo "::group::create pull request" gh pr create \ - --title "upstream merge template repository" \ + --title ${PR_TITLE} \ --body "Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}" \ -B "${UPSTREAM_BRANCH}" \ -l "${PR_LABELS}"