feat(github): create gists from the selection or files (#6765)

Adds Git > GitHub > Create Gist... From the editor it posts the selection, or the whole file without one; from the Project view and editor tabs it posts the selected files (folders are skipped). The dialog asks for a file name (single file only) and a description, with Secret (on by default), Open in browser and Copy URL; the choices are remembered. The gist is created with gh api under the project's GitHub account and a notification links to it.

Closes #6714

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-29 13:57:17 +08:00
1 джерело f40b645c8e
коміт be7a0cfa5b
13 files changed
+305 -2

No files matched your search

+19
Переглянути файл
@@ -110,6 +110,25 @@ describe("a GitHub Enterprise Server repository", () => {
expect(await connect(s.remotes[1]!)).toBe(true);
expect(ghApi).toHaveBeenLastCalledWith("/w/app", expect.objectContaining({ host: null }));
});
it("stops sending requests to the server once disconnected (another project)", async () => {
layout = { "/w/app": [{ name: "origin", url: "[email protected]:acme/app.git" }] };
ghAvailability.mockReturnValue(
ok({ kind: "ready", repo: { nameWithOwner: "acme/app", url: "https://ghe.example.com/acme/app" }, login: "al" }),
);
ghApi.mockImplementation((_repo: string | null, req: { endpoint: string }) =>
ok(
req.endpoint === "user"
? JSON.stringify({ id: 1, node_id: "U1", login: "al", avatar_url: "", html_url: "" })
: JSON.stringify({ data: { repository: { id: "R1", owner: { login: "acme" }, name: "app" } } }),
),
);
await refreshConnection();
expect(useGhRepository.getState().connection?.coordinates.host).toBe("ghe.example.com");
resetConnection();
await rest("POST", "gists", {});
expect(ghApi).toHaveBeenLastCalledWith(null, expect.objectContaining({ endpoint: "gists", host: null }));
});
});
describe("GitHub Enterprise Server hosts beside github.com", () => {