mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Rename root action inputs and outputs (#681)
This commit is contained in:
+13
-8
@@ -12,9 +12,14 @@ import {
|
||||
|
||||
(async () => {
|
||||
throwOnRenamedInputs({
|
||||
commitMode: "commit-mode",
|
||||
createGithubReleases: "create-github-releases",
|
||||
publish: "publish-script",
|
||||
version: "version-script",
|
||||
commit: "commit-mesage",
|
||||
title: "pr-title",
|
||||
branch: "pr-base-branch",
|
||||
prDraft: "pr-draft",
|
||||
createGithubReleases: "create-github-releases",
|
||||
commitMode: "commit-mode",
|
||||
setupGitUser: "setup-git-user",
|
||||
});
|
||||
|
||||
@@ -55,7 +60,7 @@ import {
|
||||
|
||||
let { changesets } = await readChangesetState(cwd);
|
||||
|
||||
let publishScript = core.getInput("publish");
|
||||
let publishScript = core.getInput("publish-script");
|
||||
let hasChangesets = changesets.length !== 0;
|
||||
const hasNonEmptyChangesets = changesets.some(
|
||||
(changeset) => changeset.releases.length > 0,
|
||||
@@ -168,17 +173,17 @@ import {
|
||||
return;
|
||||
case hasChangesets: {
|
||||
const { pullRequestNumber } = await runVersion({
|
||||
script: getOptionalInput("version"),
|
||||
script: getOptionalInput("version-script"),
|
||||
github,
|
||||
cwd,
|
||||
prTitle: getOptionalInput("title"),
|
||||
commitMessage: getOptionalInput("commit"),
|
||||
prTitle: getOptionalInput("pr-title"),
|
||||
commitMessage: getOptionalInput("commit-message"),
|
||||
hasPublishScript,
|
||||
prDraft,
|
||||
branch: getOptionalInput("branch"),
|
||||
branch: getOptionalInput("pr-base-branch"),
|
||||
});
|
||||
|
||||
core.setOutput("pull-request-number", String(pullRequestNumber));
|
||||
core.setOutput("pr-number", String(pullRequestNumber));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
+12
-3
@@ -136,13 +136,22 @@ export function getRequiredInput(name: string) {
|
||||
}
|
||||
|
||||
export function throwOnRenamedInputs(renames: Record<string, string>) {
|
||||
const references: Record<string, string> = {};
|
||||
|
||||
for (const [oldInput, newInput] of Object.entries(renames)) {
|
||||
if (core.getInput(oldInput)) {
|
||||
throw new Error(
|
||||
`The input "${oldInput}" has been renamed to "${newInput}". Please update your workflow file.`,
|
||||
);
|
||||
references[oldInput] = newInput;
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(references).length > 0) {
|
||||
const list = Object.entries(references)
|
||||
.map(([oldInput, newInput]) => `- "${oldInput}" -> "${newInput}"`)
|
||||
.join("\n");
|
||||
throw new Error(
|
||||
`The following inputs have been renamed:\n${list}\nPlease update your workflow file.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveChangesetsCli(cwd: string) {
|
||||
|
||||
Reference in New Issue
Block a user