diff --git a/docs/releases/v[object Object]-changelog.md b/docs/releases/v[object Object]-changelog.md new file mode 100644 index 00000000..a28396bd --- /dev/null +++ b/docs/releases/v[object Object]-changelog.md @@ -0,0 +1,9 @@ +# Release v[object Object] + +Upgrade Helper: [https://backstage.github.io/upgrade-helper/?to=[object Object]](https://backstage.github.io/upgrade-helper/?to=[object Object]) + +## ignored-package-pkg-b@1.1.0 + +### Minor Changes + +- Awesome feature diff --git a/src/index.ts b/src/index.ts index 087eccc5..68a953bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -102,6 +102,8 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined; githubToken, prTitle: getOptionalInput("title"), commitMessage: getOptionalInput("commit"), + releaseVersion: getOptionalInput("releaseVersion"), + changelogPath: getOptionalInput("changelogPath"), hasPublishScript, }); diff --git a/src/run.ts b/src/run.ts index 532396b0..6786d9e7 100644 --- a/src/run.ts +++ b/src/run.ts @@ -175,6 +175,8 @@ type VersionOptions = { prTitle?: string; commitMessage?: string; hasPublishScript?: boolean; + changelogPath?: string; + releaseVersion?: string; }; type RunVersionResult = { @@ -185,9 +187,11 @@ export async function runVersion({ script, githubToken, cwd = process.cwd(), + releaseVersion, prTitle = "Version Packages", commitMessage = "Version Packages", hasPublishScript = false, + changelogPath = "docs/releases", }: VersionOptions): Promise { let repo = `${github.context.repo.owner}/${github.context.repo.repo}`; let branch = github.context.ref.replace("refs/heads/", ""); @@ -219,7 +223,7 @@ export async function runVersion({ }); let changedPackages = await getChangedPackages(cwd, versionsByDirectory); - const { version: releaseVersion } = await fs.readJson( + releaseVersion = releaseVersion ? releaseVersion : await fs.readJson( path.resolve(cwd, "package.json") ); @@ -252,7 +256,8 @@ ${changelogEntries .join("\n")} `; - const changelogPath = `docs/releases/v${releaseVersion}-changelog.md`; + const file = `v${releaseVersion}-changelog.md`; + const fullChangelogPath = `${changelogPath}/${file}`; try { const prettier = require(resolveFrom(cwd, "prettier")); @@ -263,9 +268,9 @@ ${changelogEntries }); } catch {} - await fs.writeFile(changelogPath, changelogBody); + await fs.writeFile(fullChangelogPath, changelogBody); - const prBody = `See [${changelogPath}](https://github.com/backstage/backstage/blob/master/${changelogPath}) for more information.`; + const prBody = `See [${fullChangelogPath}](https://github.com/backstage/backstage/blob/master/${fullChangelogPath}) for more information.`; const finalPrTitle = `${prTitle}${!!preState ? ` (${preState.tag})` : ""}`;