MCPcopy Create free account
hub / github.com/github/awesome-copilot / cloneSubmissionRepository

Function cloneSubmissionRepository

eng/external-plugin-quality-gates.mjs:106–134  ·  view source on GitHub ↗
(workDir, plugin)

Source from the content-addressed store, hash-verified

104}
105
106function cloneSubmissionRepository(workDir, plugin) {
107 const repoDir = path.join(workDir, "submission");
108 ensureDirectory(repoDir);
109
110 const sourceRepo = plugin.source?.repo;
111 const fetchSpec = resolveFetchSpec(plugin.source ?? {});
112
113 const init = runCommand("git", ["init", "-q"], { cwd: repoDir });
114 if (init.exitCode !== 0) {
115 throw new Error(`git init failed: ${init.output}`);
116 }
117
118 const addRemote = runCommand("git", ["remote", "add", "origin", `https://github.com/${sourceRepo}.git`], { cwd: repoDir });
119 if (addRemote.exitCode !== 0) {
120 throw new Error(`git remote add failed: ${addRemote.output}`);
121 }
122
123 const fetch = runCommand("git", ["fetch", "--depth=1", "origin", fetchSpec], { cwd: repoDir });
124 if (fetch.exitCode !== 0) {
125 throw new Error(`git fetch failed for ${fetchSpec}: ${fetch.output}`);
126 }
127
128 const checkout = runCommand("git", ["checkout", "--detach", "FETCH_HEAD"], { cwd: repoDir });
129 if (checkout.exitCode !== 0) {
130 throw new Error(`git checkout failed: ${checkout.output}`);
131 }
132
133 return repoDir;
134}
135
136// Ordered list of candidate locations for plugin.json, from most to least specific.
137// Both the Copilot CLI and many external repos use nested conventions. We read the

Callers 1

Calls 3

ensureDirectoryFunction · 0.85
resolveFetchSpecFunction · 0.85
runCommandFunction · 0.70

Tested by

no test coverage detected