From 54cfa2b691cdb9b9b3e74e345f4cb0108114d098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 13 Jan 2025 16:36:34 +0100 Subject: [PATCH] Add source_pr_author template to backport action (#15394) Allow substituting PR author in the title and description templates. This allows the PR title to mimic the message that GH would autogenerate in release notes, so backported PRs don't look out of place and don't have to be manually fixed. --- .github/workflows/backport-base.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backport-base.yml b/.github/workflows/backport-base.yml index d9f833965ea..7cac9a0dc6b 100644 --- a/.github/workflows/backport-base.yml +++ b/.github/workflows/backport-base.yml @@ -2,12 +2,12 @@ on: workflow_call: inputs: pr_title_template: - description: 'The template used for the PR title. Special placeholder tokens that will be replaced with a value: %target_branch%, %source_pr_title%, %source_pr_number%, %cc_users%.' + description: 'The template used for the PR title. Special placeholder tokens that will be replaced with a value: %target_branch%, %source_pr_title%, %source_pr_number%, %source_pr_author%, %cc_users%.' required: false type: string default: '[%target_branch%] %source_pr_title%' pr_description_template: - description: 'The template used for the PR description. Special placeholder tokens that will be replaced with a value: %target_branch%, %source_pr_title%, %source_pr_number%, %cc_users%.' + description: 'The template used for the PR description. Special placeholder tokens that will be replaced with a value: %target_branch%, %source_pr_title%, %source_pr_number%, %source_pr_author%, %cc_users%.' required: false type: string default: | @@ -178,12 +178,14 @@ jobs: .replace(/%target_branch%/g, target_branch) .replace(/%source_pr_title%/g, context.payload.issue.title) .replace(/%source_pr_number%/g, context.payload.issue.number) + .replace(/%source_pr_author%/g, context.payload.issue.user.login) .replace(/%cc_users%/g, cc_users); const backport_pr_description = BACKPORT_PR_DESCRIPTION_TEMPLATE .replace(/%target_branch%/g, target_branch) .replace(/%source_pr_title%/g, context.payload.issue.title) .replace(/%source_pr_number%/g, context.payload.issue.number) + .replace(/%source_pr_author%/g, context.payload.issue.user.login) .replace(/%cc_users%/g, cc_users); // open the GitHub PR