mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Update @changesets/ghcommit to v3 beta (#675)
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
co-authored by
Mateusz Burzyński
parent
823cf741ca
commit
a35a66bd1e
+3
-10
@@ -2,7 +2,7 @@ import { Buffer } from "node:buffer";
|
||||
import * as core from "@actions/core";
|
||||
import { exec, getExecOutput } from "@actions/exec";
|
||||
import { context } from "@actions/github";
|
||||
import { commitChangesFromRepo } from "@changesets/ghcommit/git";
|
||||
import { commitChangesSinceBase } from "@changesets/ghcommit";
|
||||
import { setupOctokit, type Octokit } from "./octokit.ts";
|
||||
|
||||
export type CommitMode = "git-cli" | "github-api";
|
||||
@@ -146,14 +146,7 @@ export class GitHub {
|
||||
|
||||
async pushChanges({ branch, message }: { branch: string; message: string }) {
|
||||
if (this.commitMode === "github-api") {
|
||||
/**
|
||||
* Only add files form the current working directory
|
||||
*
|
||||
* This will emulate the behavior of `git add .`,
|
||||
* used in {@link commitAll}.
|
||||
*/
|
||||
const addFromDirectory = this.cwd;
|
||||
return commitChangesFromRepo({
|
||||
await commitChangesSinceBase({
|
||||
octokit: this.octokit,
|
||||
...context.repo,
|
||||
branch,
|
||||
@@ -162,8 +155,8 @@ export class GitHub {
|
||||
commit: context.sha,
|
||||
},
|
||||
cwd: this.cwd,
|
||||
force: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!(await checkIfClean({ cwd: this.cwd }))) {
|
||||
await commitAll(message, { cwd: this.cwd });
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ vi.mock("@actions/github", () => ({
|
||||
graphql: mockedGraphql,
|
||||
}),
|
||||
}));
|
||||
vi.mock("@changesets/ghcommit/git");
|
||||
vi.mock("@changesets/ghcommit");
|
||||
|
||||
let mockedGithubMethods = {
|
||||
pulls: {
|
||||
|
||||
@@ -321,13 +321,6 @@ export async function runVersion({
|
||||
!!preState ? ` (${preState.tag})` : ""
|
||||
}`;
|
||||
|
||||
/**
|
||||
* Fetch any existing pull requests that are open against the branch,
|
||||
* before we push any changes that may inadvertently close the existing PRs.
|
||||
*
|
||||
* (`@changesets/ghcommit` has to reset the branch to the same commit as the base,
|
||||
* which GitHub will then react to by closing the PRs)
|
||||
*/
|
||||
const existingPullRequests = await octokit.rest.pulls.list({
|
||||
...context.repo,
|
||||
state: "open",
|
||||
|
||||
Reference in New Issue
Block a user