Skip to content

Commit

Permalink
Add source_pr_author template to backport action (#15394)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nohwnd authored Jan 13, 2025
1 parent 218f31a commit 54cfa2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/backport-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 54cfa2b

Please sign in to comment.