@cliangdev/flux-plugin 0.4.0-dev.38b2bd1 → 0.4.0-dev.a68828a
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/package.json
CHANGED
|
@@ -223,7 +223,14 @@ describe("prd status mappers", () => {
|
|
|
223
223
|
expect(prdStatusToLabel("ARCHIVED")).toBeNull();
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
test("labelToPrdStatus detects
|
|
226
|
+
test("labelToPrdStatus detects COMPLETED from closed state with completed label", async () => {
|
|
227
|
+
const { labelToPrdStatus } = await import("../mappers/prd.js");
|
|
228
|
+
expect(labelToPrdStatus(["flux:prd", "status:completed"], true)).toBe(
|
|
229
|
+
"COMPLETED",
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
test("labelToPrdStatus detects ARCHIVED from closed state without completed label", async () => {
|
|
227
234
|
const { labelToPrdStatus } = await import("../mappers/prd.js");
|
|
228
235
|
expect(labelToPrdStatus(["flux:prd", "status:draft"], true)).toBe(
|
|
229
236
|
"ARCHIVED",
|
|
@@ -23,7 +23,10 @@ export function labelToPrdStatus(
|
|
|
23
23
|
labels: string[],
|
|
24
24
|
isClosed: boolean,
|
|
25
25
|
): PrdStatus {
|
|
26
|
-
if (isClosed)
|
|
26
|
+
if (isClosed) {
|
|
27
|
+
if (labels.includes(GITHUB_LABELS.STATUS_COMPLETED)) return "COMPLETED";
|
|
28
|
+
return "ARCHIVED";
|
|
29
|
+
}
|
|
27
30
|
|
|
28
31
|
if (labels.includes(GITHUB_LABELS.STATUS_COMPLETED)) return "COMPLETED";
|
|
29
32
|
if (labels.includes(GITHUB_LABELS.STATUS_BREAKDOWN_READY))
|
|
@@ -453,10 +453,26 @@ async function runUpdate(params: {
|
|
|
453
453
|
token: string;
|
|
454
454
|
owner: string;
|
|
455
455
|
repo: string;
|
|
456
|
+
gql: (
|
|
457
|
+
query: string,
|
|
458
|
+
vars: Record<string, unknown>,
|
|
459
|
+
) => Promise<Record<string, Record<string, unknown>>>;
|
|
456
460
|
}): Promise<ConfigureResult> {
|
|
457
461
|
const projectJsonPath = config.projectJsonPath;
|
|
458
462
|
const existing = JSON.parse(readFileSync(projectJsonPath, "utf-8"));
|
|
459
463
|
existing.adapter.config.token = params.token;
|
|
464
|
+
|
|
465
|
+
const adapterConfig = existing.adapter?.config;
|
|
466
|
+
if (adapterConfig?.projectId && !adapterConfig.statusField) {
|
|
467
|
+
const statusField = await configureStatusField(
|
|
468
|
+
params.gql,
|
|
469
|
+
adapterConfig.projectId,
|
|
470
|
+
);
|
|
471
|
+
if (statusField) {
|
|
472
|
+
adapterConfig.statusField = statusField;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
460
476
|
writeFileSync(projectJsonPath, JSON.stringify(existing, null, 2));
|
|
461
477
|
|
|
462
478
|
const repoUrl = `https://github.com/${params.owner}/${params.repo}`;
|
|
@@ -504,6 +520,7 @@ async function handler(input: unknown) {
|
|
|
504
520
|
token,
|
|
505
521
|
owner: parsed.owner,
|
|
506
522
|
repo: parsed.repo,
|
|
523
|
+
gql: gqlWithAuth,
|
|
507
524
|
});
|
|
508
525
|
} else if (mode === "join" && remoteConfig) {
|
|
509
526
|
result = await runJoin({
|