Skip to content

Commit

Permalink
Merge pull request #409 from jschmid1/feat/pull_description_body
Browse files Browse the repository at this point in the history
feat: add `pull_description` to placeholders
  • Loading branch information
korthout authored Jan 22, 2024
2 parents 7a2d0af + 29fedd9 commit 8546a41
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ Placeholder | Replaced with
------------|------------
`issue_refs` | GitHub issue references to all issues mentioned in the original pull request description seperated by a space, e.g. `#123 #456 korthout/backport-action#789`
`pull_author` | The username of the original pull request's author, e.g. `korthout`
`pull_description`| The description (i.e. body) of the original pull request that is backported, e.g. `Summary: This patch was created to..`
`pull_number` | The number of the original pull request that is backported, e.g. `123`
`pull_title` | The title of the original pull request that is backported, e.g. `fix: some error`
`target_branch`| The branchname to which the pull request is backported, e.g. `release-0.23`
Expand Down
2 changes: 2 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,13 @@ exports.getMentionedIssueRefs = exports.replacePlaceholders = void 0;
* @returns Description that can be used in the backport pull request
*/
function replacePlaceholders(template, main, target) {
var _a;
const issues = getMentionedIssueRefs(main.body);
return template
.replace("${pull_author}", main.user.login)
.replace("${pull_number}", main.number.toString())
.replace("${pull_title}", main.title)
.replace("${pull_description", (_a = main.body) !== null && _a !== void 0 ? _a : "")
.replace("${target_branch}", target)
.replace("${issue_refs}", issues.join(" "));
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function replacePlaceholders(
.replace("${pull_author}", main.user.login)
.replace("${pull_number}", main.number.toString())
.replace("${pull_title}", main.title)
.replace("${pull_description", main.body ?? "")
.replace("${target_branch}", target)
.replace("${issue_refs}", issues.join(" "));
}
Expand Down

0 comments on commit 8546a41

Please sign in to comment.