Skip to content

Commit 96095bd

Browse files
Jno21matherm-aboehmsemantic-release-github-commit[bot]
authored
fix(prepare): variable substitution for ${nextRelease.notes} (#17) (#18)
* fix(prepare): variable substitution for `${nextRelease.notes}` (#17) * fix(prepare): variable substitution for `${nextRelease.notes}` * test(prepare): fix test with template variables in commit message * chore(release): update package.json version to 1.0.1-beta.1 [skip ci] --------- Co-authored-by: Andreas Böhm <60391995+matherm-aboehm@users.noreply.github.com> Co-authored-by: semantic-release-github-commit[bot] <238512118+semantic-release-github-commit[bot]@users.noreply.github.com>
1 parent df8bcd2 commit 96095bd

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jno21/semantic-release-github-commit",
3-
"version": "1.0.0",
3+
"version": "1.0.1-beta.1",
44
"description": "Semantic-release plugin to commit files to GitHub using the REST API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/prepare.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ export async function prepare(
101101
commitMessage = commitMessage
102102
.replace(/\$\{nextRelease\.version\}/g, nextRelease.version)
103103
.replace(/\$\{nextRelease\.gitTag\}/g, nextRelease.gitTag)
104-
.replace(/\$\{nextRelease\.gitHead\}/g, nextRelease.gitHead);
104+
.replace(/\$\{nextRelease\.gitHead\}/g, nextRelease.gitHead)
105+
.replace(/\$\{nextRelease\.notes\}/g, nextRelease.notes);
105106
} else if (!nextRelease) {
106107
// Fallback if no nextRelease context
107108
commitMessage = commitMessage || "chore(release): update [skip ci]";

test/prepare.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ describe("prepare", () => {
261261
const pluginConfig: PluginConfig = {
262262
files: ["dist/**"],
263263
commitMessage:
264-
"release: ${nextRelease.version} tag: ${nextRelease.gitTag}",
264+
`release: \${nextRelease.version} tag: \${nextRelease.gitTag}
265+
head: \${nextRelease.gitHead} notes: \${nextRelease.notes}`,
265266
};
266267
const context = createMockContext({
267268
nextRelease: {
@@ -285,7 +286,8 @@ describe("prepare", () => {
285286

286287
expect(mockGitHubClient.createCommit).toHaveBeenCalledWith(
287288
expect.any(Object),
288-
"release: 1.2.3 tag: v1.2.3",
289+
`release: 1.2.3 tag: v1.2.3
290+
head: abc123 notes: Release notes`,
289291
expect.any(String),
290292
expect.any(Array),
291293
undefined,

0 commit comments

Comments
 (0)