diff --git a/README.md b/README.md index 4718b320..635e124c 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ You will receive a pull request within your repository if there are some changes | 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` | | +| pr_commit_msg | `[optional]` commit message in the created pull request | `false` | `chore(template): merge template changes :up:` | | hostname | `[optional]` the hostname of the repository | `false` | `github.com` | | is_dry_run | `[optional]` set to `true` if you do not want to push the changes and not want to create a PR | `false` | | diff --git a/action.yml b/action.yml index 1112e282..99520439 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,9 @@ inputs: default: 'upstream merge template repository' pr_labels: description: '[optional] comma separated list of pull request labels' + pr_commit_msg: + description: '[optional] the commit message of the template merge' + default: 'chore(template): merge template changes :up:' hostname: description: '[optional] the hostname of the GitHub repository' default: 'github.com' @@ -41,5 +44,6 @@ runs: PR_BRANCH_NAME_PREFIX: ${{ inputs.pr_branch_name_prefix }} PR_TITLE: ${{ inputs.pr_title }} PR_LABELS: ${{ inputs.pr_labels }} + PR_COMMIT_MSG: ${{ inputs.pr_commit_msg }} HOSTNAME: ${{ inputs.hostname }} IS_DRY_RUN: ${{ inputs.is_dry_run }} diff --git a/src/sync_template.sh b/src/sync_template.sh index d01629cd..a0a16b3b 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -3,6 +3,11 @@ set -e # set -u set -x +if [[ -z "${PR_COMMIT_MSG}" ]]; then + echo "::error::Missing env variable 'PR_COMMIT_MSG'" >&2; + exit 1; +fi + if [[ -z "${SOURCE_REPO}" ]]; then echo "::error::Missing env variable 'SOURCE_REPO'" >&2; exit 1; @@ -74,7 +79,7 @@ then git checkout -- . fi -git commit -m "chore(template): merge template changes :up:" +git commit -m "${PR_COMMIT_MSG}" push_and_create_pr () { if [ "$IS_DRY_RUN" != "true" ]; then