mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Skip creating a PR when all existing changesets are empty (#206)
* Don't create a PR if all changesets are empty Fixes #205. Note that this maintains the previous behavior that if there are any changesets (even empty ones), the action does not publish packages. * Create three-needles-protect.md * Update .changeset/three-needles-protect.md Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
co-authored by
Mateusz Burzyński
parent
6a46d2c283
commit
8c3f5f5637
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@changesets/action": patch
|
||||
---
|
||||
|
||||
Skip creating a PR when all existing changesets are empty.
|
||||
@@ -37,6 +37,9 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
||||
|
||||
let publishScript = core.getInput("publish");
|
||||
let hasChangesets = changesets.length !== 0;
|
||||
const hasNonEmptyChangesets = changesets.some(
|
||||
(changeset) => changeset.releases.length > 0
|
||||
);
|
||||
let hasPublishScript = !!publishScript;
|
||||
|
||||
core.setOutput("published", "false");
|
||||
@@ -96,6 +99,9 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case hasChangesets && !hasNonEmptyChangesets:
|
||||
console.log("All changesets are empty; not creating PR");
|
||||
return;
|
||||
case hasChangesets:
|
||||
const { pullRequestNumber } = await runVersion({
|
||||
script: getOptionalInput("version"),
|
||||
|
||||
Reference in New Issue
Block a user