-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpatch-gh-aw-lock.mjs
More file actions
69 lines (63 loc) · 2.9 KB
/
Copy pathpatch-gh-aw-lock.mjs
File metadata and controls
69 lines (63 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { readFile, writeFile } from "node:fs/promises";
const workflows = new URL("../workflows/", import.meta.url);
async function patchCopilotByokOutput(name) {
const path = new URL(name, workflows);
const source = await readFile(path, "utf8");
const activation = source.match(/jobs:\n activation:[\s\S]*?\n agent:/)?.[0];
if (!activation) throw new Error("gh-aw activation job not found");
if (activation.includes("secret_verification_result:")) return;
const marker =
" stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}";
if (!activation.includes(marker)) throw new Error("gh-aw output marker not found");
const note = "# v0.82.14 BYOK compiler workaround; remove after upstream fixes conclusion guards.";
await writeFile(
path,
source.replace(marker, `${marker}\n ${note}\n secret_verification_result: ""`),
);
}
async function patchOpenCodeProvider() {
const path = new URL("pi-runtime-review.lock.yml", workflows);
const source = await readFile(path, "utf8");
const markers = [
['"autoupdate": false,', '"autoupdate": false,\n "model": "awf-proxy/glm-5.2",'],
['"api": "http://172.30.0.30:10002"', '"api": "http://172.30.0.30:10000"'],
['"apiKey": "awf-copilot-proxy"', '"apiKey": "awf-openai-proxy"'],
['"claude-sonnet-4.5": {}', '"glm-5.2": {}'],
];
let patched = source;
for (const [oldValue, newValue] of markers) {
if (!patched.includes(oldValue) && !patched.includes(newValue)) {
throw new Error(`gh-aw OpenCode marker not found: ${oldValue}`);
}
if (!patched.includes(newValue)) patched = patched.replaceAll(oldValue, newValue);
}
await writeFile(path, patched);
}
async function patchDisabledDetectionOutput() {
const path = new URL("issue-triage.lock.yml", workflows);
const source = await readFile(path, "utf8");
const oldValue =
"DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}";
const newValue = "DETECTION_AGENTIC_EXECUTION_OUTCOME: skipped";
if (!source.includes(oldValue) && !source.includes(newValue)) {
throw new Error("gh-aw disabled detection marker not found");
}
await writeFile(path, source.replace(oldValue, newValue));
}
async function patchMaintenanceChoice() {
const path = new URL("agentics-maintenance.yml", workflows);
const source = await readFile(path, "utf8");
if (source.includes(" default: 'none'\n options:\n - 'none'")) return;
const patched = source.replace(" default: ''\n options:\n - ''", " default: 'none'\n options:\n - 'none'");
if (patched === source) throw new Error("gh-aw maintenance choice marker not found");
await writeFile(path, patched);
}
for (const name of [
"issue-triage.lock.yml",
"pi-upstream-lockstep.lock.yml",
]) {
await patchCopilotByokOutput(name);
}
await patchOpenCodeProvider();
await patchDisabledDetectionOutput();
await patchMaintenanceChoice();