Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pull_description to placeholders #409

Merged
merged 3 commits into from Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
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
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
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