From 94bb376585630574860d9da5379ba56792366188 Mon Sep 17 00:00:00 2001 From: Marc Siebeneicher Date: Thu, 8 Dec 2022 09:55:21 +0100 Subject: [PATCH 1/3] feat: make commit msg configurable --- action.yml | 4 ++++ src/sync_template.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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..fcadb839 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -74,7 +74,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 From 47cab269dd4b656ca36a61a64760e6568ada0d8a Mon Sep 17 00:00:00 2001 From: Marc Siebeneicher Date: Thu, 8 Dec 2022 10:28:27 +0100 Subject: [PATCH 2/3] docs(parameters): add pr_commit_msg input description --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6c9ede0b..375c5901 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` | | From 2187b0f0506f9c307da9bdc794d526139a89e147 Mon Sep 17 00:00:00 2001 From: Marc Siebeneicher Date: Mon, 12 Dec 2022 09:46:46 +0100 Subject: [PATCH 3/3] feat(sync_template): add env check for PR_COMMIT_MSG --- src/sync_template.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sync_template.sh b/src/sync_template.sh index fcadb839..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;