mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Use GitHub API for pushes by default and require explicit github-token when using custom tokens (#692)
* Ensure `github-token` wins for `git-cli` pushes * more shenanigans * Default to GitHub API commit mode * e2e auth tests * push missing utils * rename input * refactor * refactor * refactor * refactor * refactor * refactor * reuse helpers * refactor * refactor * simplify * add tests * refactor * improve comments * shift helper * add comments * extract test helpers * update docs and changesets * update one thing
This commit is contained in:
+19
-1
@@ -1,9 +1,10 @@
|
||||
import { createFixture } from "fs-fixture";
|
||||
import { expect, test } from "vitest";
|
||||
import { afterEach, expect, test, vi } from "vitest";
|
||||
import {
|
||||
BumpLevels,
|
||||
getChangelogEntry,
|
||||
sortTheThings,
|
||||
throwOnRemovedCommitModeInput,
|
||||
validateChangesetsCliVersion,
|
||||
} from "./utils.ts";
|
||||
|
||||
@@ -74,6 +75,10 @@ let changelog = `# @keystone-alpha/email
|
||||
- Update mjml-dependency
|
||||
`;
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
test("it works", () => {
|
||||
let entry = getChangelogEntry(changelog, "3.0.0");
|
||||
expect(entry.content).toMatchSnapshot();
|
||||
@@ -107,6 +112,19 @@ test("it sorts the things right", () => {
|
||||
expect(things.sort(sortTheThings)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test.each([
|
||||
["commit-mode", "git-cli", "push-with-git-cli: true"],
|
||||
["commit-mode", "github-api", "push-with-git-cli: false"],
|
||||
["commitMode", "git-cli", "push-with-git-cli: true"],
|
||||
["commitMode", "github-api", "push-with-git-cli: false"],
|
||||
])(
|
||||
"explains how to migrate the removed %s input from %s",
|
||||
(inputName, value, replacement) => {
|
||||
vi.stubEnv(`INPUT_${inputName.toUpperCase()}`, value);
|
||||
expect(() => throwOnRemovedCommitModeInput()).toThrow(replacement);
|
||||
},
|
||||
);
|
||||
|
||||
test("throws when the project declares Changesets CLI v2", async () => {
|
||||
await using fixture = await createFixture({
|
||||
"package.json": JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user