@bdsqqq/lnr-cli 1.4.0 → 1.5.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/package.json +1 -1
- package/src/router/issues.ts +25 -4
package/package.json
CHANGED
package/src/router/issues.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
deleteReaction,
|
|
23
23
|
createIssueRelation,
|
|
24
24
|
getProject,
|
|
25
|
+
linkGitHubPR,
|
|
25
26
|
type Issue,
|
|
26
27
|
type ListIssuesFilter,
|
|
27
28
|
type Comment,
|
|
@@ -78,6 +79,7 @@ const issueInput = z.object({
|
|
|
78
79
|
unreact: z.string().optional().describe("reaction id to remove"),
|
|
79
80
|
parent: z.string().optional().describe("set parent issue identifier"),
|
|
80
81
|
subIssues: z.boolean().optional().describe("list sub-issues"),
|
|
82
|
+
pr: z.string().optional().describe("link a github pr url"),
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
type IssueInput = z.infer<typeof issueInput>;
|
|
@@ -428,6 +430,15 @@ async function handleUpdateIssue(
|
|
|
428
430
|
console.log(`removed reaction ${input.unreact.slice(0, 8)}`);
|
|
429
431
|
}
|
|
430
432
|
|
|
433
|
+
// Link PR
|
|
434
|
+
if (input.pr) {
|
|
435
|
+
const success = await linkGitHubPR(client, issue.id, input.pr);
|
|
436
|
+
if (!success) {
|
|
437
|
+
exitWithError(`failed to link pr`);
|
|
438
|
+
}
|
|
439
|
+
console.log(`linked ${input.pr} to ${identifier}`);
|
|
440
|
+
}
|
|
441
|
+
|
|
431
442
|
// Archive last (restricts further edits)
|
|
432
443
|
if (input.archive) {
|
|
433
444
|
await archiveIssue(client, issue.id);
|
|
@@ -521,10 +532,19 @@ async function handleCreateIssue(input: IssueInput): Promise<void> {
|
|
|
521
532
|
}
|
|
522
533
|
|
|
523
534
|
const issue = await createIssue(client, createPayload);
|
|
524
|
-
if (issue) {
|
|
525
|
-
console.log(`created ${issue.identifier}: ${issue.title}`);
|
|
526
|
-
} else {
|
|
535
|
+
if (!issue) {
|
|
527
536
|
console.log("created issue");
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
console.log(`created ${issue.identifier}: ${issue.title}`);
|
|
541
|
+
|
|
542
|
+
if (input.pr) {
|
|
543
|
+
const success = await linkGitHubPR(client, issue.id, input.pr);
|
|
544
|
+
if (!success) {
|
|
545
|
+
exitWithError(`failed to link pr`);
|
|
546
|
+
}
|
|
547
|
+
console.log(`linked ${input.pr} to ${issue.identifier}`);
|
|
528
548
|
}
|
|
529
549
|
} catch (error) {
|
|
530
550
|
handleApiError(error);
|
|
@@ -568,7 +588,8 @@ export const issuesRouter = router({
|
|
|
568
588
|
input.parent ||
|
|
569
589
|
input.blocks ||
|
|
570
590
|
input.blockedBy ||
|
|
571
|
-
input.relatesTo
|
|
591
|
+
input.relatesTo ||
|
|
592
|
+
input.pr;
|
|
572
593
|
|
|
573
594
|
if (hasUpdate) {
|
|
574
595
|
await handleUpdateIssue(input.idOrNew, input);
|