mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Add parameter to control version script (#23)
* Add version script * Run build Co-authored-by: mitchellhamilton <mitchell@hamil.town>
This commit is contained in:
co-authored by
mitchellhamilton
parent
65b9570cef
commit
d6b65536ef
@@ -59,6 +59,7 @@ import readChangesets from "@changesets/read";
|
||||
let hasChangesets = changesets.length !== 0;
|
||||
|
||||
let publishScript = core.getInput("publish");
|
||||
let versionScript = core.getInput("version");
|
||||
|
||||
if (!hasChangesets && !publishScript) {
|
||||
console.log("No changesets found");
|
||||
@@ -164,13 +165,20 @@ import readChangesets from "@changesets/read";
|
||||
}
|
||||
|
||||
await exec("git", ["reset", "--hard", github.context.sha]);
|
||||
let changesetsCliPkgJson = await fs.readJson(
|
||||
path.join("node_modules", "@changesets", "cli", "package.json")
|
||||
);
|
||||
let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0")
|
||||
? "bump"
|
||||
: "version";
|
||||
await exec("node", ["./node_modules/@changesets/cli/bin.js", cmd]);
|
||||
|
||||
if (versionScript) {
|
||||
let [versionCommand, ...versionArgs] = versionScript.split(/\s+/);
|
||||
await exec(versionCommand, versionArgs);
|
||||
} else {
|
||||
let changesetsCliPkgJson = await fs.readJson(
|
||||
path.join("node_modules", "@changesets", "cli", "package.json")
|
||||
);
|
||||
let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0")
|
||||
? "bump"
|
||||
: "version";
|
||||
await exec("node", ["./node_modules/@changesets/cli/bin.js", cmd]);
|
||||
}
|
||||
|
||||
let searchQuery = `repo:${repo}+state:open+head:${versionBranch}+base:${branch}`;
|
||||
let searchResultPromise = octokit.search.issuesAndPullRequests({
|
||||
q: searchQuery
|
||||
|
||||
Reference in New Issue
Block a user