From 4de370836c885d055e3a4847562effee6affdc2f Mon Sep 17 00:00:00 2001 From: Andy Augustin Date: Tue, 5 Mar 2024 19:34:11 +0100 Subject: [PATCH 1/2] feat(#477): :sparkles: add custom PR message body --- README.md | 1 + action.yml | 2 ++ src/sync_template.sh | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 66c162de..bc4f6d2e 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ jobs: | source_repo_ssh_private_key | `[optional]` private ssh key for the source 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_body | `[optional]` the body of PRs opened by this action. | `false` | `Merge ${SOURCE_REPO_PATH} ${TEMPLATE_GIT_HASH}` | | pr_labels | `[optional]` comma separated list. [pull request labels][pr-labels]. | `false` | `sync_template` | | pr_reviewers | `[optional]` comma separated list of pull request reviewers. | `false` | | | pr_commit_msg | `[optional]` commit message in the created pull request | `false` | `chore(template): merge template changes :up:` | diff --git a/action.yml b/action.yml index 8fc113e0..bc1c656f 100644 --- a/action.yml +++ b/action.yml @@ -22,6 +22,8 @@ inputs: pr_title: description: "[optional] the title of PRs opened by this action" default: "upstream merge template repository" + pr_body: + description: "[optional] the body of PRs opened by this action" pr_labels: description: "[optional] comma separated list of pull request labels" default: "template_sync" diff --git a/src/sync_template.sh b/src/sync_template.sh index a474dd38..25f4db6b 100644 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -44,6 +44,7 @@ TEMPLATE_SYNC_IGNORE_FILE_PATH=".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="${PR_BRANCH_NAME_PREFIX}_${NEW_TEMPLATE_GIT_HASH}" +PR_BODY="${PR_BODY:-Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}}" debug "new Git HASH ${NEW_TEMPLATE_GIT_HASH}" echo "::group::Check new changes" @@ -234,7 +235,7 @@ function push () { function create_pr () { gh pr create \ --title "${PR_TITLE}" \ - --body "Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}" \ + --body "${PR_BODY}" \ --base "${UPSTREAM_BRANCH}" \ --label "${PR_LABELS}" \ --reviewer "${PR_REVIEWERS}" From 31d0f946dd95dad2957af47c9e179af682189c52 Mon Sep 17 00:00:00 2001 From: Andy Augustin Date: Tue, 5 Mar 2024 19:42:06 +0100 Subject: [PATCH 2/2] fix: :bug: --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index bc1c656f..41e2f6d4 100644 --- a/action.yml +++ b/action.yml @@ -67,6 +67,7 @@ runs: 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_BODY: ${{ inputs.pr_body }} PR_LABELS: ${{ inputs.pr_labels }} PR_REVIEWERS: ${{ inputs.pr_reviewers }} PR_COMMIT_MSG: ${{ inputs.pr_commit_msg }}