gcb-host 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/lib/broker.d.ts.map +1 -1
- package/lib/broker.js +7 -1
- package/lib/broker.js.map +1 -1
- package/lib/commands/doctor.d.ts +17 -0
- package/lib/commands/doctor.d.ts.map +1 -0
- package/lib/commands/doctor.js +238 -0
- package/lib/commands/doctor.js.map +1 -0
- package/lib/commands/host.d.ts +33 -0
- package/lib/commands/host.d.ts.map +1 -0
- package/lib/commands/host.js +522 -0
- package/lib/commands/host.js.map +1 -0
- package/lib/daemon.js +1 -1
- package/lib/daemon.js.map +1 -1
- package/lib/gh.d.ts.map +1 -1
- package/lib/gh.js +8 -1
- package/lib/gh.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/lib/commands/host-opener.d.ts +0 -33
- package/lib/commands/host-opener.d.ts.map +0 -1
- package/lib/commands/host-opener.js +0 -343
- package/lib/commands/host-opener.js.map +0 -1
package/lib/gh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gh.js","sourceRoot":"","sources":["../src/gh.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAqB,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MA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,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type CommandBackend } from 'gcb-core';
|
|
7
7
|
export * from './gh.ts';
|
|
8
|
-
export declare const HOST_HELP = "gcb-host \u2014 host-side gcb broker and administration commands.\n\nUsage: gcb <command> [options]\n\nCommands\n app Run the app broker (alias for daemon)\n host Run the host
|
|
8
|
+
export declare const HOST_HELP = "gcb-host \u2014 host-side gcb broker and administration commands.\n\nUsage: gcb <command> [options]\n\nCommands\n app Run the app broker (alias for daemon)\n host Run the host broker (typed host operations)\n daemon Run the broker (normally started by the service manager)\n init Create or update the broker config, and install the key\n stage Export a reviewed commit to where the broker will run\n compose Print a Docker sidecar definition for the broker\n config Validate or edit the broker configuration\n diagnose Ask GitHub what the App can actually see\n doctor Report config digest, last reload and socket state\n authorize Authorize this app once for person-authored pull requests\n\nClient commands such as setup/probe/logs/pr are in gcb-client.";
|
|
9
9
|
export declare const hostBackend: CommandBackend;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAG9D,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAG9D,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,SAAS,g0BAgByC,CAAC;AAiChE,eAAO,MAAM,WAAW,EAAE,cAKzB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -12,15 +12,15 @@ Usage: gcb <command> [options]
|
|
|
12
12
|
|
|
13
13
|
Commands
|
|
14
14
|
app Run the app broker (alias for daemon)
|
|
15
|
-
host Run the host
|
|
15
|
+
host Run the host broker (typed host operations)
|
|
16
16
|
daemon Run the broker (normally started by the service manager)
|
|
17
17
|
init Create or update the broker config, and install the key
|
|
18
18
|
stage Export a reviewed commit to where the broker will run
|
|
19
19
|
compose Print a Docker sidecar definition for the broker
|
|
20
20
|
config Validate or edit the broker configuration
|
|
21
21
|
diagnose Ask GitHub what the App can actually see
|
|
22
|
+
doctor Report config digest, last reload and socket state
|
|
22
23
|
authorize Authorize this app once for person-authored pull requests
|
|
23
|
-
host-opener Watch for the container's pull-request requests and create them
|
|
24
24
|
|
|
25
25
|
Client commands such as setup/probe/logs/pr are in gcb-client.`;
|
|
26
26
|
async function run(argv) {
|
|
@@ -42,11 +42,12 @@ async function run(argv) {
|
|
|
42
42
|
return (await import('./commands/config.js')).runConfig(rest);
|
|
43
43
|
case 'diagnose':
|
|
44
44
|
return (await import('./commands/diagnose.js')).runDiagnose(rest);
|
|
45
|
+
case 'doctor':
|
|
46
|
+
return (await import('./commands/doctor.js')).runDoctor(rest);
|
|
45
47
|
case 'authorize':
|
|
46
48
|
return (await import('./commands/authorize.js')).runAuthorize(rest);
|
|
47
49
|
case 'host':
|
|
48
|
-
|
|
49
|
-
return (await import('./commands/host-opener.js')).runHostOpener(rest);
|
|
50
|
+
return (await import('./commands/host.js')).runHostBroker(rest);
|
|
50
51
|
default:
|
|
51
52
|
process.stderr.write(`gcb: unknown host command \`${command ?? ''}\`.\n`);
|
|
52
53
|
return 1;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAuB,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,cAAc,SAAS,CAAC;AAExB,MAAM,CAAC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AClE;YACE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,OAAO,IAAI,EAAE,OAAO,CAAC,CAAC;YAC1E,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,aAAa;IACvB,IAAI,EAAE,SAAS;IACf,GAAG;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gcb-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Host-side gcb broker, configuration, providers and administration commands.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "JounQin <admin@1stg.me>",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"gcb-core": "0.
|
|
30
|
+
"gcb-core": "0.4.0",
|
|
31
31
|
"node-fetch-native": "^1.6.7",
|
|
32
32
|
"x-fetch": "^0.3.0",
|
|
33
33
|
"yaml": "^2.9.1"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/** Usage text for `host-opener`. */
|
|
2
|
-
export declare const HOST_OPENER_USAGE = "Usage: gcb host-opener [options]\n\nRun on the host, once, beside the trees the container also sees. It finds the checkouts under the\nroots it is given \u2014 ones created later included \u2014 and fulfils their requests to create a pull request, issue\nor fork with the gh account each request names, so the result is authored by a person rather than by\nthe app's bot. It does nothing else: it cannot push, merge or close anything.\n\n --root <dir> A tree to serve, repeatable (default: $HOME)\n --depth <n> How far below a root to look for checkouts (default: 4)\n --repo <path> Serve this one checkout instead of discovering any\n --config <path> Broker config whose allowlist fork requests are checked against\n (default: $GIT_BROKER_CONFIG, else ./broker.config.yml)\n --command <path> The program that creates a pull request, issue or fork\n (default: $GIT_BROKER_PR_COMMAND, else gh)\n --arg <token> An extra argument for that program, before the subcommand (repeatable)\n --interval <seconds> How often to look for requests (default: 5)\n --once Fulfil what is waiting, then exit\n -h, --help Show this help\n\nThe container asks for this by passing --as-user to `pr`. Requests are files under\n<git dir>/gcb/pr-requests, which is shared with the container and untracked by git\n\u2014 so the paths on the two sides never have to match: each writes and reads its own view of the same\ndirectory, and only the roots this process scans are host-side paths.\n";
|
|
3
|
-
/**
|
|
4
|
-
* Read a pull request's number and URL out of a program's output.
|
|
5
|
-
*
|
|
6
|
-
* `gh pr create` prints the URL, and so does anything that behaves like it. Nothing else is trusted:
|
|
7
|
-
* without a URL in the output the opener reports a failure rather than guessing.
|
|
8
|
-
*
|
|
9
|
-
* @param output - the program's standard output.
|
|
10
|
-
* @returns the number and URL, or `undefined`.
|
|
11
|
-
*/
|
|
12
|
-
export declare function pullRequestUrl(output: string): {
|
|
13
|
-
number: number;
|
|
14
|
-
url: string;
|
|
15
|
-
} | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Pull the issue number and URL out of the program's output.
|
|
18
|
-
*
|
|
19
|
-
* @param output - the program's standard output.
|
|
20
|
-
* @returns the number and URL, or `undefined`.
|
|
21
|
-
*/
|
|
22
|
-
export declare function issueUrl(output: string): {
|
|
23
|
-
number: number;
|
|
24
|
-
url: string;
|
|
25
|
-
} | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Run the `host-opener` command.
|
|
28
|
-
*
|
|
29
|
-
* @param argv - arguments after the command name.
|
|
30
|
-
* @returns the process exit code.
|
|
31
|
-
*/
|
|
32
|
-
export declare function runHostOpener(argv: readonly string[]): Promise<number>;
|
|
33
|
-
//# sourceMappingURL=host-opener.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"host-opener.d.ts","sourceRoot":"","sources":["../../src/commands/host-opener.ts"],"names":[],"mappings":"AA6CA,oCAAoC;AACpC,eAAO,MAAM,iBAAiB,+jDAuB7B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAK1F;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAKpF;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA8F5E"}
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `host-opener` — fulfil the container's requests to open pull requests or issues with the gh account
|
|
3
|
-
* each request names.
|
|
4
|
-
*
|
|
5
|
-
* This runs on the host, beside the checkout the container also sees, and it does exactly one thing:
|
|
6
|
-
* it turns a request file into a pull request or issue, using the gh account the request names. That
|
|
7
|
-
* is the whole point — content authored by a person is what automated reviewers will actually review,
|
|
8
|
-
* and the app cannot be that person.
|
|
9
|
-
*
|
|
10
|
-
* It has no other power. It cannot push, merge, close or read anything, and it never runs a shell: the
|
|
11
|
-
* program it calls is configuration, and it is called with an argument list built here.
|
|
12
|
-
*/
|
|
13
|
-
import { execFile } from 'node:child_process';
|
|
14
|
-
import { existsSync, mkdtempSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
15
|
-
import { homedir, tmpdir } from 'node:os';
|
|
16
|
-
import { join, resolve } from 'node:path';
|
|
17
|
-
import { promisify } from 'node:util';
|
|
18
|
-
import { channelDir, clearOpener, discoverCheckouts, findGitDir, listRequests, readOpener, claimRequest, removeRequest, requestProblems, writeOpener, writeResult, HOST, } from 'gcb-core';
|
|
19
|
-
import { fail, listFlag, parseArgs, say, warn } from 'gcb-core';
|
|
20
|
-
import { applyProxyChoice, parseProxy } from '../http.js';
|
|
21
|
-
import { loadConfig, resolveConfigPath } from '../config.js';
|
|
22
|
-
import { hostConfig, repoAllowed } from '../policy.js';
|
|
23
|
-
const run = promisify(execFile);
|
|
24
|
-
/** How long one `pr create` or `issue create` may take. */
|
|
25
|
-
const CREATE_TIMEOUT_MS = 120_000;
|
|
26
|
-
/** Usage text for `host-opener`. */
|
|
27
|
-
export const HOST_OPENER_USAGE = `Usage: gcb host-opener [options]
|
|
28
|
-
|
|
29
|
-
Run on the host, once, beside the trees the container also sees. It finds the checkouts under the
|
|
30
|
-
roots it is given — ones created later included — and fulfils their requests to create a pull request, issue
|
|
31
|
-
or fork with the gh account each request names, so the result is authored by a person rather than by
|
|
32
|
-
the app's bot. It does nothing else: it cannot push, merge or close anything.
|
|
33
|
-
|
|
34
|
-
--root <dir> A tree to serve, repeatable (default: $HOME)
|
|
35
|
-
--depth <n> How far below a root to look for checkouts (default: 4)
|
|
36
|
-
--repo <path> Serve this one checkout instead of discovering any
|
|
37
|
-
--config <path> Broker config whose allowlist fork requests are checked against
|
|
38
|
-
(default: $GIT_BROKER_CONFIG, else ./broker.config.yml)
|
|
39
|
-
--command <path> The program that creates a pull request, issue or fork
|
|
40
|
-
(default: $GIT_BROKER_PR_COMMAND, else gh)
|
|
41
|
-
--arg <token> An extra argument for that program, before the subcommand (repeatable)
|
|
42
|
-
--interval <seconds> How often to look for requests (default: 5)
|
|
43
|
-
--once Fulfil what is waiting, then exit
|
|
44
|
-
-h, --help Show this help
|
|
45
|
-
|
|
46
|
-
The container asks for this by passing --as-user to \`pr\`. Requests are files under
|
|
47
|
-
<git dir>/gcb/pr-requests, which is shared with the container and untracked by git
|
|
48
|
-
— so the paths on the two sides never have to match: each writes and reads its own view of the same
|
|
49
|
-
directory, and only the roots this process scans are host-side paths.
|
|
50
|
-
`;
|
|
51
|
-
/**
|
|
52
|
-
* Read a pull request's number and URL out of a program's output.
|
|
53
|
-
*
|
|
54
|
-
* `gh pr create` prints the URL, and so does anything that behaves like it. Nothing else is trusted:
|
|
55
|
-
* without a URL in the output the opener reports a failure rather than guessing.
|
|
56
|
-
*
|
|
57
|
-
* @param output - the program's standard output.
|
|
58
|
-
* @returns the number and URL, or `undefined`.
|
|
59
|
-
*/
|
|
60
|
-
export function pullRequestUrl(output) {
|
|
61
|
-
const match = /https:\/\/[^\s]+\/pull\/(\d+)/.exec(output);
|
|
62
|
-
const digits = match?.[1];
|
|
63
|
-
if (!match || digits === undefined)
|
|
64
|
-
return undefined;
|
|
65
|
-
return { number: Number(digits), url: match[0] };
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Pull the issue number and URL out of the program's output.
|
|
69
|
-
*
|
|
70
|
-
* @param output - the program's standard output.
|
|
71
|
-
* @returns the number and URL, or `undefined`.
|
|
72
|
-
*/
|
|
73
|
-
export function issueUrl(output) {
|
|
74
|
-
const match = /https:\/\/[^\s]+\/issues\/(\d+)/.exec(output);
|
|
75
|
-
const digits = match?.[1];
|
|
76
|
-
if (!match || digits === undefined)
|
|
77
|
-
return undefined;
|
|
78
|
-
return { number: Number(digits), url: match[0] };
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Run the `host-opener` command.
|
|
82
|
-
*
|
|
83
|
-
* @param argv - arguments after the command name.
|
|
84
|
-
* @returns the process exit code.
|
|
85
|
-
*/
|
|
86
|
-
export async function runHostOpener(argv) {
|
|
87
|
-
const args = parseArgs(argv, { booleans: ['help', 'once'] });
|
|
88
|
-
if (args.has('help') || args.has('h')) {
|
|
89
|
-
say(HOST_OPENER_USAGE);
|
|
90
|
-
return 0;
|
|
91
|
-
}
|
|
92
|
-
const explicit = args.value('repo');
|
|
93
|
-
const single = explicit === undefined ? undefined : resolve(explicit);
|
|
94
|
-
const roots = listFlag(args, 'root');
|
|
95
|
-
const scanned = roots.length > 0 ? roots.map((root) => resolve(root)) : [homedir()];
|
|
96
|
-
const depth = Number(args.value('depth') ?? '4');
|
|
97
|
-
const command = args.value('command') ?? process.env['GIT_BROKER_PR_COMMAND'] ?? 'gh';
|
|
98
|
-
const configPath = args.value('config');
|
|
99
|
-
let config;
|
|
100
|
-
/** Whether the broker's allowlist permits this host/repository, loaded only for fork requests. */
|
|
101
|
-
const allowed = (host, repo) => {
|
|
102
|
-
if (config === undefined) {
|
|
103
|
-
try {
|
|
104
|
-
config = loadConfig(resolveConfigPath(configPath));
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
throw new Error(`a fork needs the broker config allowlist: ${error.message}; pass --config or set GIT_BROKER_CONFIG`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const block = hostConfig(config, host);
|
|
111
|
-
return block !== null && repoAllowed(block.allow, repo);
|
|
112
|
-
};
|
|
113
|
-
const extra = listFlag(args, 'arg');
|
|
114
|
-
const interval = Number(args.value('interval') ?? '5');
|
|
115
|
-
if (!Number.isFinite(interval) || interval < 1) {
|
|
116
|
-
fail(`--interval must be at least one second, got ${JSON.stringify(args.value('interval'))}`);
|
|
117
|
-
}
|
|
118
|
-
if (!Number.isInteger(depth) || depth < 0) {
|
|
119
|
-
fail(`--depth must be a whole number of levels, got ${JSON.stringify(args.value('depth'))}`);
|
|
120
|
-
}
|
|
121
|
-
/** The checkouts to serve: one named checkout, or everything under the roots. */
|
|
122
|
-
const targets = () => {
|
|
123
|
-
if (single === undefined)
|
|
124
|
-
return scanned.flatMap((root) => discoverCheckouts(root, depth));
|
|
125
|
-
const gitDir = findGitDir(single);
|
|
126
|
-
if (gitDir === undefined)
|
|
127
|
-
fail(`no git repository at or above ${single}`);
|
|
128
|
-
return [{ repo: single, dir: channelDir(gitDir) }];
|
|
129
|
-
};
|
|
130
|
-
const advertised = new Set();
|
|
131
|
-
/** Advertise a channel, without rewriting the marker on every sweep. */
|
|
132
|
-
const advertise = (dir) => {
|
|
133
|
-
advertised.add(dir);
|
|
134
|
-
if (readOpener(dir)?.pid !== process.pid) {
|
|
135
|
-
writeOpener(dir, {
|
|
136
|
-
pid: process.pid,
|
|
137
|
-
command,
|
|
138
|
-
startedAt: new Date().toISOString(),
|
|
139
|
-
kinds: ['pull-request', 'issue', 'fork'],
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
// However this process ends — a signal, --once, an exception — its markers go with it. A stale
|
|
144
|
-
// marker would tell the container an opener is there and make it wait for an answer that is not
|
|
145
|
-
// coming.
|
|
146
|
-
process.on('exit', () => {
|
|
147
|
-
for (const dir of advertised) {
|
|
148
|
-
try {
|
|
149
|
-
if (readOpener(dir)?.pid === process.pid)
|
|
150
|
-
clearOpener(dir);
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
// Nothing useful is left to do while exiting.
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
const stop = () => process.exit(0);
|
|
158
|
-
process.on('SIGINT', stop);
|
|
159
|
-
process.on('SIGTERM', stop);
|
|
160
|
-
say(single === undefined ? `serving the checkouts under ${scanned.join(', ')}` : `serving ${single}`);
|
|
161
|
-
say(`creating pull requests, issues and forks with ${command}${extra.length > 0 ? ` ${extra.join(' ')}` : ''}, as the request's account or this user`);
|
|
162
|
-
for (;;) {
|
|
163
|
-
for (const { repo, dir } of targets()) {
|
|
164
|
-
// One checkout the container has made hostile — its channel directory replaced by a file, say —
|
|
165
|
-
// must not stop the opener serving every other root, under Restart=always least of all.
|
|
166
|
-
try {
|
|
167
|
-
advertise(dir);
|
|
168
|
-
await sweep(dir, repo, command, extra, allowed);
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
warn(`could not serve ${repo}: ${error.message}`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (args.has('once'))
|
|
175
|
-
return 0;
|
|
176
|
-
await new Promise((done) => setTimeout(done, Math.max(interval, 0) * 1000));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Answer everything waiting in the channel.
|
|
181
|
-
*
|
|
182
|
-
* @param dir - the channel directory.
|
|
183
|
-
* @param repo - the checkout to create pull requests or issues in.
|
|
184
|
-
* @param command - the program to call.
|
|
185
|
-
* @param extra - arguments to pass before the subcommand.
|
|
186
|
-
* @returns how many requests were answered.
|
|
187
|
-
*/
|
|
188
|
-
async function sweep(dir, repo, command, extra, allowed) {
|
|
189
|
-
let answered = 0;
|
|
190
|
-
for (const id of listRequests(dir)) {
|
|
191
|
-
// Claimed, not read: two openers — a service and a hand-run --once — would otherwise both act on the
|
|
192
|
-
// same request and each create it, under the person's name.
|
|
193
|
-
const request = claimRequest(dir, id);
|
|
194
|
-
if (!request) {
|
|
195
|
-
// Either unreadable or already claimed, and the two are not worth telling apart here: removing
|
|
196
|
-
// anything now would delete another opener's claim, which is the claim's whole purpose.
|
|
197
|
-
warn(`skipped ${id}: unreadable, or another opener has it`);
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
const problems = requestProblems(request);
|
|
201
|
-
if (problems.length > 0) {
|
|
202
|
-
writeResult(dir, id, { error: problems.join('; ') });
|
|
203
|
-
removeRequest(dir, id);
|
|
204
|
-
warn(`refused ${id}: ${problems.join('; ')}`);
|
|
205
|
-
answered += 1;
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
const proxy = parseProxy(request.proxy);
|
|
209
|
-
if (proxy === false) {
|
|
210
|
-
writeResult(dir, id, { error: 'invalid proxy in the request' });
|
|
211
|
-
removeRequest(dir, id);
|
|
212
|
-
warn(`refused ${id}: invalid proxy`);
|
|
213
|
-
answered += 1;
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
const result = await openOne(repo, command, extra, { ...request, proxy }, allowed);
|
|
217
|
-
writeResult(dir, id, result);
|
|
218
|
-
removeRequest(dir, id);
|
|
219
|
-
if (result.error !== undefined) {
|
|
220
|
-
warn(`failed to open ${request.kind === 'fork' ? 'fork' : request.kind === 'issue' ? 'issue' : request.head}: ${result.error}`);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
say(request.kind === 'fork'
|
|
224
|
-
? `forked ${request.repo} as ${request.account ?? 'this user'}: ${result.url}`
|
|
225
|
-
: `opened #${result.number} as ${request.account ?? 'this user'}: ${result.url}`);
|
|
226
|
-
}
|
|
227
|
-
answered += 1;
|
|
228
|
-
}
|
|
229
|
-
return answered;
|
|
230
|
-
}
|
|
231
|
-
/** Environment for one gh call: the selected account or inherited config, plus the proxy choice. */
|
|
232
|
-
function forkEnv(proxy, account, host) {
|
|
233
|
-
const env = openerEnv(proxy, account);
|
|
234
|
-
// gh chooses between GH_TOKEN and GH_ENTERPRISE_TOKEN by host; forcing GH_HOST is what keeps an
|
|
235
|
-
// inherited token from selecting another instance. Named accounts already had their tokens removed.
|
|
236
|
-
env['GH_HOST'] = host;
|
|
237
|
-
return env;
|
|
238
|
-
}
|
|
239
|
-
function openerEnv(proxy, account) {
|
|
240
|
-
const env = { ...process.env };
|
|
241
|
-
if (account !== undefined) {
|
|
242
|
-
const dir = join(homedir(), '.config', `gh-${account}`);
|
|
243
|
-
if (!existsSync(dir) || !statSync(dir).isDirectory()) {
|
|
244
|
-
throw new Error(`no gh config for account ${JSON.stringify(account)} at ${dir}`);
|
|
245
|
-
}
|
|
246
|
-
// Tokens in the opener's own environment would override the selected account's config.
|
|
247
|
-
delete env['GH_TOKEN'];
|
|
248
|
-
delete env['GITHUB_TOKEN'];
|
|
249
|
-
delete env['GH_ENTERPRISE_TOKEN'];
|
|
250
|
-
delete env['GITHUB_ENTERPRISE_TOKEN'];
|
|
251
|
-
delete env['GH_HOST'];
|
|
252
|
-
env['GH_CONFIG_DIR'] = dir;
|
|
253
|
-
}
|
|
254
|
-
applyProxyChoice(env, proxy);
|
|
255
|
-
return env;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Create one pull request, issue or fork.
|
|
259
|
-
*
|
|
260
|
-
* @param repo - the checkout to create it in.
|
|
261
|
-
* @param command - the program to call.
|
|
262
|
-
* @param extra - arguments to pass before the subcommand.
|
|
263
|
-
* @param request - what to create.
|
|
264
|
-
* @returns the number and URL, or the reason it did not work.
|
|
265
|
-
*/
|
|
266
|
-
async function openOne(repo, command, extra, request, allowed) {
|
|
267
|
-
if (request.kind === 'fork') {
|
|
268
|
-
if (request.host !== undefined && !HOST.test(request.host)) {
|
|
269
|
-
return { error: `not a host: ${JSON.stringify(request.host)}` };
|
|
270
|
-
}
|
|
271
|
-
const host = request.host ?? 'github.com';
|
|
272
|
-
try {
|
|
273
|
-
if (!allowed(host, request.repo)) {
|
|
274
|
-
return { error: `repository ${request.repo} is not in the allowlist for ${host}` };
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
return { error: error.message };
|
|
279
|
-
}
|
|
280
|
-
try {
|
|
281
|
-
const { stdout, stderr } = await run(command, [...extra, 'repo', 'fork', request.repo], {
|
|
282
|
-
cwd: repo,
|
|
283
|
-
timeout: CREATE_TIMEOUT_MS,
|
|
284
|
-
maxBuffer: 1 << 20,
|
|
285
|
-
env: forkEnv(request.proxy, request.account, host),
|
|
286
|
-
});
|
|
287
|
-
const match = /https:\/\/[^\s]+\/[^\s/]+\/[^\s/]+/.exec(stdout);
|
|
288
|
-
if (match?.[0] !== undefined)
|
|
289
|
-
return { url: match[0] };
|
|
290
|
-
// With no TTY, gh prints the URL only for a fresh fork; an existing fork older than a minute
|
|
291
|
-
// is `owner/name already exists` on stderr with empty stdout and exit 0.
|
|
292
|
-
const existing = /^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+) already exists$/m.exec(stderr);
|
|
293
|
-
if (existing?.[1] !== undefined) {
|
|
294
|
-
return { url: `https://${host}/${existing[1]}` };
|
|
295
|
-
}
|
|
296
|
-
return { error: `no fork URL in the output: ${(stdout.trim() || stderr.trim()).slice(0, 300)}` };
|
|
297
|
-
}
|
|
298
|
-
catch (error) {
|
|
299
|
-
const failure = error;
|
|
300
|
-
const reason = (failure.stderr ?? failure.message ?? 'the command failed').trim();
|
|
301
|
-
return { error: reason.slice(0, 300) || 'the command failed' };
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
// The body goes to a private temp file: the program is given a path, never a string to interpret.
|
|
305
|
-
const scratch = mkdtempSync(join(tmpdir(), 'gcb-'));
|
|
306
|
-
const bodyFile = join(scratch, 'body.md');
|
|
307
|
-
writeFileSync(bodyFile, request.body, 'utf8');
|
|
308
|
-
const issue = request.kind === 'issue';
|
|
309
|
-
try {
|
|
310
|
-
const { stdout, stderr } = await run(command, [
|
|
311
|
-
...extra,
|
|
312
|
-
issue ? 'issue' : 'pr',
|
|
313
|
-
'create',
|
|
314
|
-
// No `--repo`: gh resolves the repository from the checkout it runs in, which is the checkout the
|
|
315
|
-
// request was written in. That is a mechanism, not a boundary — the container can edit that checkout,
|
|
316
|
-
// its remote included. What a deployment controls is which roots are served, which program runs
|
|
317
|
-
// and which account directories exist; what this reaches is whatever the account the request
|
|
318
|
-
// names can reach.
|
|
319
|
-
...(!issue && request.draft === true ? ['--draft'] : []),
|
|
320
|
-
...(issue ? [] : ['--base', request.base, '--head', request.head]),
|
|
321
|
-
'--title',
|
|
322
|
-
request.title,
|
|
323
|
-
'--body-file',
|
|
324
|
-
bodyFile,
|
|
325
|
-
], { cwd: repo, timeout: CREATE_TIMEOUT_MS, maxBuffer: 1 << 20, env: openerEnv(request.proxy, request.account) });
|
|
326
|
-
const found = issue ? issueUrl(stdout) : pullRequestUrl(stdout);
|
|
327
|
-
if (!found) {
|
|
328
|
-
return {
|
|
329
|
-
error: `no ${issue ? 'issue' : 'pull request'} URL in the output: ${(stdout.trim() || stderr.trim()).slice(0, 300)}`,
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
return found;
|
|
333
|
-
}
|
|
334
|
-
catch (error) {
|
|
335
|
-
const failure = error;
|
|
336
|
-
const reason = (failure.stderr ?? failure.message ?? 'the command failed').trim();
|
|
337
|
-
return { error: reason.slice(0, 300) || 'the command failed' };
|
|
338
|
-
}
|
|
339
|
-
finally {
|
|
340
|
-
rmSync(scratch, { recursive: true, force: true });
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
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