Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

respect skip and none releases for prereleases #1738

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/core/src/__tests__/auto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,33 @@ describe("Auto", () => {
await auto.next({});
expect(afterRelease).toHaveBeenCalled();
});

test("respects none release labels", async () => {
const auto = new Auto({ ...defaults, plugins: [] });

// @ts-ignore
auto.checkClean = () => Promise.resolve(true);
auto.logger = dummyLog();
await auto.loadConfig();
auto.remote = "origin";
auto.git!.publish = () => Promise.resolve({ data: {} } as any);
auto.git!.getLastTagNotInBaseBranch = () =>
Promise.reject(new Error("Test"));
auto.git!.getLatestTagInBranch = () => Promise.reject(new Error("Test"));
auto.git!.getLatestRelease = () => Promise.resolve("abcd");
auto.release!.generateReleaseNotes = () => Promise.resolve("notes");
auto.release!.getCommitsInRelease = () =>
Promise.resolve([
makeCommitFromMsg("Test Commit", { labels: ["skip-release"] }),
]);

const next = jest.fn();
auto.hooks.next.tap("test", next);
jest.spyOn(auto.release!, "getCommits").mockImplementation();

await auto.next({});
expect(next).not.toHaveBeenCalled();
});
});

describe("shipit", () => {
Expand Down
9 changes: 6 additions & 3 deletions packages/core/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,9 +1383,12 @@ export default class Auto {
const commits = await this.release.getCommitsInRelease(lastTag);
const releaseNotes = await this.release.generateReleaseNotes(lastTag);
const labels = commits.map((commit) => commit.labels);
const bump =
calculateSemVerBump(labels, this.semVerLabels!, this.config) ||
SEMVER.patch;
const bump = calculateSemVerBump(labels, this.semVerLabels!, this.config);

if (bump === "") {
this.logger.log.info("No version published.");
return;
}

if (!args.quiet) {
this.logger.log.info("Full Release notes for next release:");
Expand Down