MCPcopy Index your code
hub / github.com/fontsource/fontsource / gitRemoteAdd

Function gitRemoteAdd

packages/publish/src/git.ts:35–54  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

33
34// Setup git remote
35export const gitRemoteAdd = async (name: string): Promise<void> => {
36 const remoteURL = await execa('git', [
37 'config',
38 '--get',
39 'remote.origin.url',
40 ]);
41 // Strip https:// from remote link get
42 const strippedURL = new URL(remoteURL.stdout).host;
43
44 // git remote add origin https://username:access-token@github.com/username/repo.git
45 const publishURL = `https://${name}:${
46 // biome-ignore lint/style/noNonNullAssertion: It is guaranteed to be there.
47 process.env.GITHUB_TOKEN!
48 }@${strippedURL}`;
49 try {
50 await execa('git', ['remote', 'add', 'origin', publishURL]);
51 } catch {
52 // Git origin already exists. Continue
53 }
54};
55
56export const gitPush = async (): Promise<void> => {
57 await execa('git', ['push', 'origin', 'main']);

Callers 1

doGitOperationsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected