comfy-pr 0.2.24 → 0.2.26
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/README.md +247 -225
- package/index.ts +6 -0
- package/next-env.d.ts +5 -5
- package/package.json +52 -25
- package/src/Authors.ts +42 -48
- package/src/CMNodes.ts +60 -60
- package/src/CNRepos.ts +78 -74
- package/src/CRNodes.ts +27 -27
- package/src/CRPulls.ts +4 -4
- package/src/EmailTasks.ts +101 -0
- package/src/FORK_OWNER.ts +5 -5
- package/src/FORK_PREFIX.ts +5 -5
- package/src/FollowRules.ts +25 -25
- package/src/GIT_USEREMAIL.ts +5 -5
- package/src/GIT_USERNAME.ts +9 -9
- package/src/GithubIssueComments.ts +3 -3
- package/src/PushedBranch.ts +3 -3
- package/src/Totals.ts +24 -9
- package/src/TrackingPRs.ts +12 -12
- package/src/WorkerInstances.ts +89 -89
- package/src/addCommentAction.ts +73 -65
- package/src/analyzePullsStatus.ts +219 -170
- package/src/analyzeTotals.test.ts +5 -5
- package/src/analyzeTotals.ts +118 -118
- package/src/bypassRepos.spec.ts +10 -0
- package/src/bypassRepos.ts +8 -0
- package/src/checkComfyActivated.ts +39 -39
- package/src/checkPRsFailures.ts +18 -0
- package/src/cli.ts +40 -40
- package/src/clone_modify_push_Branches.ts +21 -21
- package/src/createComfyRegistryPRsFromCandidates.ts +55 -55
- package/src/createComfyRegistryPullRequests.ts +32 -22
- package/src/createGithubForkForRepo.ts +54 -37
- package/src/createGithubPullRequest.ts +157 -94
- package/src/createIssueComment.ts +34 -29
- package/src/fetchCMNodes.ts +22 -22
- package/src/fetchComfyRegistryNodes.ts +11 -11
- package/src/fetchCurrentGeoInfo.ts +6 -6
- package/src/fetchRelatedPullWithComments.ts +15 -15
- package/src/fetchRepoDescriptionMap.ts +15 -15
- package/src/followRuleSchema.ts +79 -76
- package/src/getActivatedShell.ts +18 -18
- package/src/getBranchWorkingDir.ts +16 -16
- package/src/getRepoWorkingDir.ts +5 -5
- package/src/ghUser.ts +9 -6
- package/src/index.ts +26 -22
- package/src/initializeFollowRules.ts +26 -26
- package/src/makePublishBranch.ts +58 -58
- package/src/makeTomlBranch.ts +53 -53
- package/src/makeUpdateTomlLicenseBranch.ts +245 -0
- package/src/matchRelatedPulls.ts +47 -60
- package/src/muteInstances.ts +16 -16
- package/src/parseIssueUrl.ts +6 -6
- package/src/parseOwnerRepo.ts +33 -33
- package/src/parsePullUrl.ts +6 -6
- package/src/parsePullsState.ts +6 -6
- package/src/parseTitleBodyOfMarkdown.ts +8 -8
- package/src/postSlackMessage.ts +21 -21
- package/src/preload.ts +30 -30
- package/src/pullStatusFollowSchema.ts +12 -12
- package/src/readTemplateTitle.ts +11 -11
- package/src/sendEmailAction.ts +56 -0
- package/src/sendGmail.ts +105 -0
- package/src/showFollowRuleSet.ts +12 -12
- package/src/summaryLastPullComment.ts +8 -8
- package/src/tomlFillDescription.ts +17 -17
- package/src/updateAuthors.ts +7 -7
- package/src/updateAuthorsForGithub.ts +54 -50
- package/src/updateAuthorsFromCNRepo.ts +30 -30
- package/src/updateCMNodesDuplicationWarnings.ts +56 -56
- package/src/updateCMRepos.ts +27 -27
- package/src/updateCNRepos.ts +58 -58
- package/src/updateCNReposCRPullsComments.ts +40 -40
- package/src/updateCNReposInfo.ts +58 -57
- package/src/updateCNReposPRCandidate.ts +85 -85
- package/src/updateCNReposPulls.ts +31 -28
- package/src/updateCNReposPullsDashboard.ts +49 -49
- package/src/updateCNReposRelatedPulls.ts +25 -25
- package/src/updateCRNodes.ts +50 -50
- package/src/updateCRRepos.ts +26 -26
- package/src/updateComfyTotals.ts +43 -43
- package/src/updateFollowRuleSet.ts +136 -127
- package/src/updateOutdatedPullsTemplates.ts +165 -160
- package/src/updateSlackMessages.ts +43 -43
- package/tailwind.config.ts +75 -20
|
@@ -1,94 +1,157 @@
|
|
|
1
|
-
import DIE from "@snomiao/die";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
srcUrl
|
|
12
|
-
dstUrl
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
import DIE, { catchArgs } from "@snomiao/die";
|
|
2
|
+
import "git-diff";
|
|
3
|
+
import { Octokit } from "octokit";
|
|
4
|
+
import { pickAll } from "rambda";
|
|
5
|
+
import sflow from "sflow";
|
|
6
|
+
import { isRepoBypassed } from "./bypassRepos";
|
|
7
|
+
import { gh } from "./gh";
|
|
8
|
+
import type { GithubPull } from "./gh/GithubPull";
|
|
9
|
+
import { parseUrlRepoOwner } from "./parseOwnerRepo";
|
|
10
|
+
if (import.meta.main) {
|
|
11
|
+
const srcUrl = "https://github.com/ComfyNodePRs/PR-ComfyUI-DareMerge-7bcbf6a9";
|
|
12
|
+
const dstUrl = "https://github.com/54rt1n/ComfyUI-DareMerge";
|
|
13
|
+
const src = parseUrlRepoOwner(srcUrl);
|
|
14
|
+
const dst = parseUrlRepoOwner(dstUrl);
|
|
15
|
+
const branch = "licence-update";
|
|
16
|
+
const repo = (await gh.repos.get({ ...dst })).data;
|
|
17
|
+
const head_repo = `${src.owner}/${src.repo}`;
|
|
18
|
+
// const head = `${src.owner}:${branch}`;
|
|
19
|
+
const head = `${src.owner}:licence-update`;
|
|
20
|
+
console.log("headrepo " + head_repo);
|
|
21
|
+
console.log("head " + head);
|
|
22
|
+
await sflow(
|
|
23
|
+
(
|
|
24
|
+
await gh.pulls.list({
|
|
25
|
+
// source repo
|
|
26
|
+
state: "all",
|
|
27
|
+
// head_repo: head_repo,
|
|
28
|
+
|
|
29
|
+
head: head,
|
|
30
|
+
// pr will merge into
|
|
31
|
+
owner: dst.owner,
|
|
32
|
+
repo: dst.repo,
|
|
33
|
+
base: repo.default_branch,
|
|
34
|
+
})
|
|
35
|
+
).data,
|
|
36
|
+
)
|
|
37
|
+
// .filter(e => head === e.head.label )
|
|
38
|
+
.map((e) => ({
|
|
39
|
+
url: e.html_url,
|
|
40
|
+
hEAD: head.trim() === e.head.label.trim(),
|
|
41
|
+
heaD: head,
|
|
42
|
+
head: e.head.label,
|
|
43
|
+
head_repo: e.head.repo.full_name,
|
|
44
|
+
}))
|
|
45
|
+
.toLog();
|
|
46
|
+
console.log("all done");
|
|
47
|
+
}
|
|
48
|
+
export async function createGithubPullRequest({
|
|
49
|
+
title,
|
|
50
|
+
body,
|
|
51
|
+
branch,
|
|
52
|
+
srcUrl,
|
|
53
|
+
dstUrl,
|
|
54
|
+
updateIfNotMatched = true,
|
|
55
|
+
}: {
|
|
56
|
+
title: string;
|
|
57
|
+
body: string;
|
|
58
|
+
branch: string;
|
|
59
|
+
srcUrl: string; // forked branch
|
|
60
|
+
dstUrl: string; // upstream
|
|
61
|
+
updateIfNotMatched?: boolean;
|
|
62
|
+
}) {
|
|
63
|
+
if (isRepoBypassed(dstUrl)) DIE("dst repo is requested to be bypassed");
|
|
64
|
+
|
|
65
|
+
const dst = parseUrlRepoOwner(dstUrl);
|
|
66
|
+
const src = parseUrlRepoOwner(srcUrl);
|
|
67
|
+
const repo = (await gh.repos.get({ ...dst })).data;
|
|
68
|
+
|
|
69
|
+
// TODO: seems has bugs on head_repo
|
|
70
|
+
const existedList = (
|
|
71
|
+
await gh.pulls.list({
|
|
72
|
+
// source repo
|
|
73
|
+
state: "all",
|
|
74
|
+
head_repo: `${src.owner}/${src.repo}`,
|
|
75
|
+
head: `${src.owner}:${branch}`,
|
|
76
|
+
// pr will merge into
|
|
77
|
+
owner: dst.owner,
|
|
78
|
+
repo: dst.repo,
|
|
79
|
+
base: repo.default_branch,
|
|
80
|
+
})
|
|
81
|
+
).data;
|
|
82
|
+
if (existedList.length > 1)
|
|
83
|
+
DIE(
|
|
84
|
+
new Error(`expect only 1 pr, but got ${existedList.length}`, {
|
|
85
|
+
cause: { existed: existedList.map((e) => ({ url: e.html_url, title: e.title })) },
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const pr_result =
|
|
90
|
+
existedList[0] ??
|
|
91
|
+
(await ghPR()
|
|
92
|
+
.pulls.create({
|
|
93
|
+
// pr info
|
|
94
|
+
title,
|
|
95
|
+
body,
|
|
96
|
+
// source repo
|
|
97
|
+
head_repo: src.owner + "/" + src.repo,
|
|
98
|
+
head: src.owner + ":" + branch,
|
|
99
|
+
// pr will merge into
|
|
100
|
+
owner: dst.owner,
|
|
101
|
+
repo: dst.repo,
|
|
102
|
+
base: repo.default_branch,
|
|
103
|
+
maintainer_can_modify: true,
|
|
104
|
+
// draft: true,
|
|
105
|
+
})
|
|
106
|
+
.then((e) => e.data)
|
|
107
|
+
|
|
108
|
+
// handle existed error
|
|
109
|
+
.catch(async (e) => {
|
|
110
|
+
if (!e.message.match("A pull request already exists for")) throw e;
|
|
111
|
+
console.error("PR Existed\n", e);
|
|
112
|
+
// WARN: will search all prs
|
|
113
|
+
const existedList = (
|
|
114
|
+
await gh.pulls.list({
|
|
115
|
+
// source repo
|
|
116
|
+
state: "open",
|
|
117
|
+
head_repo: `${src.owner}/${src.repo}`,
|
|
118
|
+
head: `${src.owner}:${branch}`,
|
|
119
|
+
// pr will merge into
|
|
120
|
+
owner: dst.owner,
|
|
121
|
+
repo: dst.repo,
|
|
122
|
+
base: repo.default_branch,
|
|
123
|
+
})
|
|
124
|
+
).data; // .filter(existed => existed.title === title);
|
|
125
|
+
|
|
126
|
+
if (existedList.length !== 1)
|
|
127
|
+
DIE(
|
|
128
|
+
new Error("expect only 1 pr, but got " + existedList.length, {
|
|
129
|
+
cause: { existed: existedList.map((e) => ({ url: e.html_url, title: e.title })) },
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return existedList[0];
|
|
134
|
+
}));
|
|
135
|
+
|
|
136
|
+
console.log("PR OK", pr_result.html_url);
|
|
137
|
+
const mismatch = pr_result.title !== title || pr_result.body !== body;
|
|
138
|
+
if (mismatch) {
|
|
139
|
+
if (!updateIfNotMatched)
|
|
140
|
+
DIE(
|
|
141
|
+
new Error("pr content mismatch", {
|
|
142
|
+
cause: { mismatch, expected: { title, body }, actual: pickAll(["title", "body"], pr_result) },
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
const { owner, repo } = parseUrlRepoOwner(dstUrl); // upstream repo
|
|
146
|
+
const updated = (await catchArgs(ghPR().pulls.update)({ pull_number: pr_result.number, body, title, owner, repo }))
|
|
147
|
+
.data!;
|
|
148
|
+
const updatedPRStillMismatch = updated.title !== title || updated.body !== body;
|
|
149
|
+
if (updatedPRStillMismatch) DIE(new Error("updatedPRStillMismatch", { cause: arguments }));
|
|
150
|
+
console.warn(`PR content updated ${owner}/${repo} / \n<< ${pr_result.title}\n>> ${updated.title}`);
|
|
151
|
+
}
|
|
152
|
+
return pr_result as GithubPull;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function ghPR() {
|
|
156
|
+
return new Octokit({ auth: process.env.GH_TOKEN_COMFY_PR || DIE(new Error("Missing env.GH_TOKEN_COMFY_PR")) }).rest;
|
|
157
|
+
}
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import DIE from "@snomiao/die";
|
|
2
|
-
import { gh } from "./gh";
|
|
3
|
-
import { ghUser } from "./ghUser";
|
|
4
|
-
import { parseIssueUrl } from "./parseIssueUrl";
|
|
5
|
-
|
|
6
|
-
if (import.meta.main) {
|
|
7
|
-
const url = "https://github.com/snomiao/ComfyNode-Registry-test/pull/1";
|
|
8
|
-
const body = "Hello World @snomiao";
|
|
9
|
-
const result = await createIssueComment(url, body, ghUser.login);
|
|
10
|
-
console.log(result.comment.html_url);
|
|
11
|
-
console.log(result.comments.map((e) => e.html_url));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
1
|
+
import DIE from "@snomiao/die";
|
|
2
|
+
import { gh } from "./gh";
|
|
3
|
+
import { ghUser } from "./ghUser";
|
|
4
|
+
import { parseIssueUrl } from "./parseIssueUrl";
|
|
5
|
+
|
|
6
|
+
if (import.meta.main) {
|
|
7
|
+
// const url = "https://github.com/snomiao/ComfyNode-Registry-test/pull/1";
|
|
8
|
+
// const body = "Hello World @snomiao";
|
|
9
|
+
// const result = await createIssueComment(url, body, ghUser.login);
|
|
10
|
+
// console.log(result.comment.html_url);
|
|
11
|
+
// console.log(result.comments.map((e) => e.html_url));
|
|
12
|
+
const url = "https://github.com/snomiao/ComfyNode-Registry-test/pull/28";
|
|
13
|
+
const body = "Hello World @robinjhuang";
|
|
14
|
+
const result = await createIssueComment(url, body, ghUser.login);
|
|
15
|
+
console.log(result.comment.html_url);
|
|
16
|
+
console.log(result.comments.map((e) => e.html_url));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function createIssueComment(issueUrl: string, body: string, by: string) {
|
|
20
|
+
const comments = (
|
|
21
|
+
await gh.issues.listComments({
|
|
22
|
+
...parseIssueUrl(issueUrl),
|
|
23
|
+
})
|
|
24
|
+
).data;
|
|
25
|
+
const result = await (async function () {
|
|
26
|
+
const commentExisted = comments.find((e) => e.body === body);
|
|
27
|
+
if (commentExisted) return { comment: commentExisted, comments };
|
|
28
|
+
if (by !== ghUser.login) DIE("Fails to creating issue: user not match");
|
|
29
|
+
const comment = (await gh.issues.createComment({ ...parseIssueUrl(issueUrl), body })).data;
|
|
30
|
+
console.log("+ IssueComment " + comment.html_url);
|
|
31
|
+
return { comment, comments: [...comments, comment] };
|
|
32
|
+
})();
|
|
33
|
+
return result;
|
|
34
|
+
}
|
package/src/fetchCMNodes.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { fetchJson } from "./utils/fetchJson";
|
|
2
|
-
|
|
3
|
-
if (import.meta.main) {
|
|
4
|
-
console.log(await fetchCMNodes());
|
|
5
|
-
}
|
|
6
|
-
export async function fetchCMNodes() {
|
|
7
|
-
const customNodeListSource =
|
|
8
|
-
process.env.CUSTOM_LIST_SOURCE ||
|
|
9
|
-
"https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json";
|
|
10
|
-
const nodeList = (await fetchJson(customNodeListSource)) as {
|
|
11
|
-
custom_nodes: {
|
|
12
|
-
author: "Dr.Lt.Data" | string;
|
|
13
|
-
title: "ComfyUI-Manager" | string;
|
|
14
|
-
id: "manager" | string;
|
|
15
|
-
reference: "https://github.com/ltdrdata/ComfyUI-Manager" | string;
|
|
16
|
-
files: ["https://github.com/ltdrdata/ComfyUI-Manager"] | string[];
|
|
17
|
-
install_type: "git-clone" | string;
|
|
18
|
-
description: "ComfyUI-Manager itself is also a custom node." | string;
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
return nodeList.custom_nodes;
|
|
22
|
-
}
|
|
1
|
+
import { fetchJson } from "./utils/fetchJson";
|
|
2
|
+
|
|
3
|
+
if (import.meta.main) {
|
|
4
|
+
console.log(await fetchCMNodes());
|
|
5
|
+
}
|
|
6
|
+
export async function fetchCMNodes() {
|
|
7
|
+
const customNodeListSource =
|
|
8
|
+
process.env.CUSTOM_LIST_SOURCE ||
|
|
9
|
+
"https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json";
|
|
10
|
+
const nodeList = (await fetchJson(customNodeListSource)) as {
|
|
11
|
+
custom_nodes: {
|
|
12
|
+
author: "Dr.Lt.Data" | string;
|
|
13
|
+
title: "ComfyUI-Manager" | string;
|
|
14
|
+
id: "manager" | string;
|
|
15
|
+
reference: "https://github.com/ltdrdata/ComfyUI-Manager" | string;
|
|
16
|
+
files: ["https://github.com/ltdrdata/ComfyUI-Manager"] | string[];
|
|
17
|
+
install_type: "git-clone" | string;
|
|
18
|
+
description: "ComfyUI-Manager itself is also a custom node." | string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
return nodeList.custom_nodes;
|
|
22
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { mockPublishedNodes } from "../mocks/mockPublishedNodes";
|
|
2
|
-
import DIE from "@snomiao/die";
|
|
3
|
-
import { fetchJson } from "./utils/fetchJson";
|
|
4
|
-
|
|
5
|
-
export async function fetchCRNodes() {
|
|
6
|
-
const r = (await fetchJson<typeof mockPublishedNodes>(
|
|
7
|
-
"https://api.comfy.org/nodes?page=1&limit=99999999"
|
|
8
|
-
)) as typeof mockPublishedNodes;
|
|
9
|
-
r.totalPages === 1 || DIE("FAIL TO FETCH ALL NODES");
|
|
10
|
-
return r.nodes;
|
|
11
|
-
}
|
|
1
|
+
import type { mockPublishedNodes } from "../mocks/mockPublishedNodes";
|
|
2
|
+
import DIE from "@snomiao/die";
|
|
3
|
+
import { fetchJson } from "./utils/fetchJson";
|
|
4
|
+
|
|
5
|
+
export async function fetchCRNodes() {
|
|
6
|
+
const r = (await fetchJson<typeof mockPublishedNodes>(
|
|
7
|
+
"https://api.comfy.org/nodes?page=1&limit=99999999"
|
|
8
|
+
)) as typeof mockPublishedNodes;
|
|
9
|
+
r.totalPages === 1 || DIE("FAIL TO FETCH ALL NODES");
|
|
10
|
+
return r.nodes;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fetchJson } from "./utils/fetchJson";
|
|
2
|
-
export async function fetchCurrentGeoInfo() {
|
|
3
|
-
const { query, city, iat, lon, countryCode, region, regionName } = (await fetchJson("http://ip-api.com/json")) as any;
|
|
4
|
-
const geo = { ip: query, city, iat, lon, countryCode, region, regionName };
|
|
5
|
-
return geo;
|
|
6
|
-
}
|
|
1
|
+
import { fetchJson } from "./utils/fetchJson";
|
|
2
|
+
export async function fetchCurrentGeoInfo() {
|
|
3
|
+
const { query, city, iat, lon, countryCode, region, regionName } = (await fetchJson("http://ip-api.com/json")) as any;
|
|
4
|
+
const geo = { ip: query, city, iat, lon, countryCode, region, regionName };
|
|
5
|
+
return geo;
|
|
6
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import pMap from "p-map";
|
|
2
|
-
import { fetchIssueComments } from "./gh/fetchIssueComments";
|
|
3
|
-
import { matchRelatedPulls } from "./matchRelatedPulls";
|
|
4
|
-
import type { GithubPullParsed } from "./parsePullsState";
|
|
5
|
-
import { summaryLastPullComment } from "./summaryLastPullComment";
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
export async function fetchRelatedPullWithComments(repository: string, pulls: GithubPullParsed[]) {
|
|
8
|
-
const relatedPulls = await matchRelatedPulls(pulls);
|
|
9
|
-
const relatedPullsWithComment = await pMap(relatedPulls, async (data) => {
|
|
10
|
-
const comments = await fetchIssueComments(repository, data.pull);
|
|
11
|
-
const lastText = summaryLastPullComment(comments);
|
|
12
|
-
return { ...data, comments, lastText };
|
|
13
|
-
});
|
|
14
|
-
return relatedPullsWithComment;
|
|
15
|
-
}
|
|
1
|
+
import pMap from "p-map";
|
|
2
|
+
import { fetchIssueComments } from "./gh/fetchIssueComments";
|
|
3
|
+
import { matchRelatedPulls } from "./matchRelatedPulls";
|
|
4
|
+
import type { GithubPullParsed } from "./parsePullsState";
|
|
5
|
+
import { summaryLastPullComment } from "./summaryLastPullComment";
|
|
6
|
+
/** @deprecated */
|
|
7
|
+
export async function fetchRelatedPullWithComments(repository: string, pulls: GithubPullParsed[]) {
|
|
8
|
+
const relatedPulls = await matchRelatedPulls(pulls);
|
|
9
|
+
const relatedPullsWithComment = await pMap(relatedPulls, async (data) => {
|
|
10
|
+
const comments = await fetchIssueComments(repository, data.pull);
|
|
11
|
+
const lastText = summaryLastPullComment(comments);
|
|
12
|
+
return { ...data, comments, lastText };
|
|
13
|
+
});
|
|
14
|
+
return relatedPullsWithComment;
|
|
15
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { fromPairs } from "rambda";
|
|
2
|
-
import { fetchCMNodes } from "./fetchCMNodes";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export async function fetchRepoDescriptionMap() {
|
|
6
|
-
const nodeList = await fetchCMNodes();
|
|
7
|
-
const repoDescriptionMap = fromPairs(
|
|
8
|
-
nodeList.map((e) => [e.reference, e.description])
|
|
9
|
-
);
|
|
10
|
-
repoDescriptionMap["https://github.com/snomiao/ComfyNode-Registry-test"] =
|
|
11
|
-
"ComfyNode-Registry-test-description";
|
|
12
|
-
|
|
13
|
-
console.log("Fetched " + nodeList.length + " CustomNode descriptions");
|
|
14
|
-
return repoDescriptionMap;
|
|
15
|
-
}
|
|
1
|
+
import { fromPairs } from "rambda";
|
|
2
|
+
import { fetchCMNodes } from "./fetchCMNodes";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export async function fetchRepoDescriptionMap() {
|
|
6
|
+
const nodeList = await fetchCMNodes();
|
|
7
|
+
const repoDescriptionMap = fromPairs(
|
|
8
|
+
nodeList.map((e) => [e.reference, e.description])
|
|
9
|
+
);
|
|
10
|
+
repoDescriptionMap["https://github.com/snomiao/ComfyNode-Registry-test"] =
|
|
11
|
+
"ComfyNode-Registry-test-description";
|
|
12
|
+
|
|
13
|
+
console.log("Fetched " + nodeList.length + " CustomNode descriptions");
|
|
14
|
+
return repoDescriptionMap;
|
|
15
|
+
}
|
package/src/followRuleSchema.ts
CHANGED
|
@@ -1,76 +1,79 @@
|
|
|
1
|
-
import { $before, $fresh, $stale } from "@/packages/mongodb-pipeline-ts/$fresh";
|
|
2
|
-
import { tryCatch } from "rambda";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
const znot_include = z.object({ "not-include": z.string() }).transform((x) => ({ $nin: x["not-include"] }));
|
|
6
|
-
const mString = z.string().transform((x) =>
|
|
7
|
-
tryCatch<string, string | RegExp>(
|
|
8
|
-
(x) => new RegExp(x) as RegExp,
|
|
9
|
-
(x) => x as string | RegExp,
|
|
10
|
-
)(x),
|
|
11
|
-
);
|
|
12
|
-
const zbefore = z
|
|
13
|
-
.object({ $before: z.coerce.date().or(z.string()).or(z.number()) })
|
|
14
|
-
.transform((x) => $before(x.$before));
|
|
15
|
-
const zfresh = z.object({ $fresh: z.coerce.date().or(z.string()).or(z.number()) }).transform((x) => $fresh(x.$fresh));
|
|
16
|
-
const mstale = z.object({ $stale: z.coerce.date().or(z.string()).or(z.number()) }).transform((x) => $stale(x.$stale));
|
|
17
|
-
const mDate = z.date().or(zbefore).or(zfresh).or(mstale);
|
|
18
|
-
const mAny = z.number().or(znot_include).or(mString).or(zbefore).or(zfresh);
|
|
19
|
-
const mNumber = z
|
|
20
|
-
.number()
|
|
21
|
-
.or(z.object({ $gt: z.number() }))
|
|
22
|
-
.or(z.object({ $lt: z.number() }))
|
|
23
|
-
.or(z.object({ $eq: z.number() }))
|
|
24
|
-
.or(z.object({ $ne: z.number() }))
|
|
25
|
-
.or(z.object({ $gte: z.number() }))
|
|
26
|
-
.or(z.object({ $lte: z.number() }));
|
|
27
|
-
export const zAddCommentAction = z
|
|
28
|
-
.object({
|
|
29
|
-
by: z.string(),
|
|
30
|
-
body: z.string(),
|
|
31
|
-
})
|
|
32
|
-
.strict();
|
|
33
|
-
const
|
|
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
|
-
.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
import { $before, $fresh, $stale } from "@/packages/mongodb-pipeline-ts/$fresh";
|
|
2
|
+
import { tryCatch } from "rambda";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
const znot_include = z.object({ "not-include": z.string() }).transform((x) => ({ $nin: x["not-include"] }));
|
|
6
|
+
const mString = z.string().transform((x) =>
|
|
7
|
+
tryCatch<string, string | RegExp>(
|
|
8
|
+
(x) => new RegExp(x) as RegExp,
|
|
9
|
+
(x) => x as string | RegExp,
|
|
10
|
+
)(x),
|
|
11
|
+
);
|
|
12
|
+
const zbefore = z
|
|
13
|
+
.object({ $before: z.coerce.date().or(z.string()).or(z.number()) })
|
|
14
|
+
.transform((x) => $before(x.$before));
|
|
15
|
+
const zfresh = z.object({ $fresh: z.coerce.date().or(z.string()).or(z.number()) }).transform((x) => $fresh(x.$fresh));
|
|
16
|
+
const mstale = z.object({ $stale: z.coerce.date().or(z.string()).or(z.number()) }).transform((x) => $stale(x.$stale));
|
|
17
|
+
const mDate = z.date().or(zbefore).or(zfresh).or(mstale);
|
|
18
|
+
const mAny = z.number().or(znot_include).or(mString).or(zbefore).or(zfresh);
|
|
19
|
+
const mNumber = z
|
|
20
|
+
.number()
|
|
21
|
+
.or(z.object({ $gt: z.number() }))
|
|
22
|
+
.or(z.object({ $lt: z.number() }))
|
|
23
|
+
.or(z.object({ $eq: z.number() }))
|
|
24
|
+
.or(z.object({ $ne: z.number() }))
|
|
25
|
+
.or(z.object({ $gte: z.number() }))
|
|
26
|
+
.or(z.object({ $lte: z.number() }));
|
|
27
|
+
export const zAddCommentAction = z
|
|
28
|
+
.object({
|
|
29
|
+
by: z.string(),
|
|
30
|
+
body: z.string(),
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
export const zSendEmailAction = z
|
|
34
|
+
.object({
|
|
35
|
+
provider: z.enum(["google"]),
|
|
36
|
+
name: z.string(),
|
|
37
|
+
from: z.string(),
|
|
38
|
+
to: z.string(),
|
|
39
|
+
subject: z.string(),
|
|
40
|
+
body: z.string(),
|
|
41
|
+
})
|
|
42
|
+
.strict();
|
|
43
|
+
const zFollowUpRule = z.object({
|
|
44
|
+
name: z.string(),
|
|
45
|
+
$match: z
|
|
46
|
+
.object({
|
|
47
|
+
actived_at: mDate,
|
|
48
|
+
email: mString,
|
|
49
|
+
comments: mNumber,
|
|
50
|
+
created_at: mDate,
|
|
51
|
+
comments_author: mString,
|
|
52
|
+
head: mString,
|
|
53
|
+
lastcomment: mString,
|
|
54
|
+
on_registry: z.boolean(),
|
|
55
|
+
nickName: mString,
|
|
56
|
+
ownername: mString,
|
|
57
|
+
state: z.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
58
|
+
emailState: z.enum(["", "waiting", "sending", "sent", "error"]),
|
|
59
|
+
updated_at: mDate,
|
|
60
|
+
url: mString,
|
|
61
|
+
})
|
|
62
|
+
.strict()
|
|
63
|
+
.partial(),
|
|
64
|
+
action: z
|
|
65
|
+
.object({
|
|
66
|
+
"add-comment": zAddCommentAction,
|
|
67
|
+
"send-email": zSendEmailAction, // WARN: not implementd
|
|
68
|
+
"update-issue": z
|
|
69
|
+
.object({
|
|
70
|
+
tags: mAny,
|
|
71
|
+
})
|
|
72
|
+
.strict(),
|
|
73
|
+
// close: z.any(),
|
|
74
|
+
})
|
|
75
|
+
.strict()
|
|
76
|
+
.partial(),
|
|
77
|
+
});
|
|
78
|
+
// zPullsStatus
|
|
79
|
+
export const zFollowUpRules = zFollowUpRule.array();
|