comfy-pr 0.2.25 → 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 +26 -4
- package/index.ts +6 -0
- package/package.json +43 -26
- package/src/Authors.ts +4 -10
- package/src/CNRepos.ts +6 -3
- package/src/EmailTasks.ts +4 -3
- package/src/addCommentAction.ts +1 -1
- package/src/analyzePullsStatus.ts +36 -10
- package/src/bypassRepos.spec.ts +10 -0
- package/src/bypassRepos.ts +8 -0
- package/src/checkPRsFailures.ts +18 -0
- package/src/clone_modify_push_Branches.ts +12 -12
- package/src/createComfyRegistryPullRequests.ts +19 -9
- package/src/createGithubForkForRepo.ts +25 -11
- package/src/createGithubPullRequest.ts +114 -51
- package/src/createIssueComment.ts +8 -3
- package/src/followRuleSchema.ts +2 -1
- package/src/ghUser.ts +3 -0
- package/src/index.ts +2 -0
- package/src/makeUpdateTomlLicenseBranch.ts +245 -0
- package/src/matchRelatedPulls.ts +21 -34
- package/src/pullStatusFollowSchema.ts +1 -1
- package/src/sendEmailAction.ts +1 -1
- package/src/sendGmail.ts +4 -3
- package/src/updateCNReposInfo.ts +5 -4
- package/src/updateCNReposPulls.ts +14 -11
- package/src/updateFollowRuleSet.ts +0 -1
- package/src/updateOutdatedPullsTemplates.ts +5 -0
- package/tailwind.config.ts +68 -13
- package/CHANGELOG.md +0 -385
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Comfy-PR
|
|
2
2
|
|
|
3
|
-
Make PRs that
|
|
3
|
+
Make PRs that helps comfy community grow with [Comfy.org](https://comfy.org/).
|
|
4
4
|
|
|
5
5
|
## Project Goals: (aka roadmap)
|
|
6
6
|
|
|
@@ -13,9 +13,9 @@ Make PRs that publishes ComfyUI Custom Nodes to [ComfyUI Registry](https://www.c
|
|
|
13
13
|
- [x] create PR to original repository with template PR description.
|
|
14
14
|
- [x] Submit PR
|
|
15
15
|
- [x] Clean local debris before clone
|
|
16
|
-
- [
|
|
16
|
+
- [x] DOING: Export PR status into csv for @haohao
|
|
17
17
|
|
|
18
|
-
### Github Actions
|
|
18
|
+
### Github Actions Workerds
|
|
19
19
|
|
|
20
20
|
- [x] Fetch repos from CM & CR list
|
|
21
21
|
- [x] Make diff
|
|
@@ -26,6 +26,8 @@ Make PRs that publishes ComfyUI Custom Nodes to [ComfyUI Registry](https://www.c
|
|
|
26
26
|
- [x] Automaticaly find candidates, and do the cli does
|
|
27
27
|
- [x] Mention related prs in dashboard https://github.com/drip-art/Comfy-Registry-PR/issues/1
|
|
28
28
|
- [x] Analyze Totals
|
|
29
|
+
- [x] license schema updator
|
|
30
|
+
- [x] bypass repo
|
|
29
31
|
- [ ] Follow-up prs by state
|
|
30
32
|
- [ ] Issues Comment
|
|
31
33
|
- [ ] Slack
|
|
@@ -35,7 +37,15 @@ Make PRs that publishes ComfyUI Custom Nodes to [ComfyUI Registry](https://www.c
|
|
|
35
37
|
### Web Site https://comfy-pr.vercel.app
|
|
36
38
|
|
|
37
39
|
- [x] A dashboard csv/yaml exporter site for @haohao
|
|
38
|
-
- [
|
|
40
|
+
- [x] pr dashboard
|
|
41
|
+
|
|
42
|
+
## Admin
|
|
43
|
+
|
|
44
|
+
### Changing PR Owner
|
|
45
|
+
|
|
46
|
+
If you wish to change which Github account the Pull Requests come from, then you need to place a Github token into the **[Actions Secrets](https://github.com/drip-art/Comfy-Registry-PR/settings/secrets/actions )**
|
|
47
|
+
|
|
48
|
+
`GH_TOKEN_COMFY_PR = ************`
|
|
39
49
|
|
|
40
50
|
## Usages
|
|
41
51
|
|
|
@@ -223,3 +233,15 @@ bun src/THAT_FILE_YOU_WANT_TO_RUN.ts
|
|
|
223
233
|
# To check if you didn't break anything?
|
|
224
234
|
bun test --watch
|
|
225
235
|
```
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## DB Inspecting
|
|
239
|
+
|
|
240
|
+
Make .env.development.local as
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
MONGODB_URI_INSPECT_HAOHAO={{that readonly db link sno gave you}}
|
|
244
|
+
MONGODB_URI=$MONGODB_URI_INSPECT_HAOHAO
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
And inspect db with script, e.g. `src/checkPRsFailures.ts`
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comfy-pr",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"description": "Make PRs that publishes ComfyUI Custom Nodes to [ComfyUI Registry]( https://www.comfyregistry.org/ ).",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
"vercel:dev": "vercel dev",
|
|
25
25
|
"vercel:build": "vercel build",
|
|
26
26
|
"build": "next build",
|
|
27
|
+
"build:worker": "bun build . --define 'import.meta.main=false' --define 'import.meta.env.IS_BUNDLE=true' --target=bun > dist/index.js",
|
|
28
|
+
"predev": "bun i",
|
|
27
29
|
"dev": "next dev",
|
|
30
|
+
"dev:tsc": "tsc -w",
|
|
28
31
|
"lint": "next lint",
|
|
29
32
|
"prerelease": "bun run build && bun run test && vercel --prod",
|
|
30
33
|
"release": "bunx standard-version && npm publish",
|
|
@@ -32,84 +35,98 @@
|
|
|
32
35
|
"test": "bun test"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
|
-
"@auth/mongodb-adapter": "^3.2
|
|
38
|
+
"@auth/mongodb-adapter": "^3.4.2",
|
|
36
39
|
"@ctrl/mac-address": "^3.0.3",
|
|
37
40
|
"@kbox-labs/react-echarts": "^1.2.0",
|
|
38
41
|
"@monaco-editor/react": "^4.6.0",
|
|
39
|
-
"@slack/web-api": "^7.
|
|
40
|
-
"@snomiao/die": "^1.
|
|
42
|
+
"@slack/web-api": "^7.3.1",
|
|
43
|
+
"@snomiao/die": "^1.2.3",
|
|
41
44
|
"@trpc/server": "^10.45.2",
|
|
42
45
|
"@types/d3": "^7.4.3",
|
|
43
46
|
"@types/file-saver": "^2.0.7",
|
|
44
|
-
"@types/
|
|
47
|
+
"@types/git-diff": "^2.0.7",
|
|
48
|
+
"@types/jest": "^29.5.12",
|
|
49
|
+
"@types/markdown-it": "^14.1.2",
|
|
45
50
|
"@types/open": "^6.2.1",
|
|
51
|
+
"bun": "^1.1.21",
|
|
52
|
+
"class-variance-authority": "^0.7.0",
|
|
53
|
+
"clsx": "^2.1.1",
|
|
46
54
|
"d3": "^7.9.0",
|
|
47
|
-
"daisyui": "^4.12.
|
|
55
|
+
"daisyui": "^4.12.10",
|
|
48
56
|
"dotenv": "^16.4.5",
|
|
49
57
|
"enhanced-ms": "^3.0.0",
|
|
50
58
|
"file-saver": "^2.0.5",
|
|
51
59
|
"flat": "^6.0.1",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
60
|
+
"git-diff": "^2.0.6",
|
|
61
|
+
"globby": "^14.0.2",
|
|
62
|
+
"google-auth-library": "^9.12.0",
|
|
54
63
|
"googleapis": "^140.0.1",
|
|
64
|
+
"googleapis-common": "^7.2.0",
|
|
55
65
|
"js-yaml": "^4.1.0",
|
|
56
66
|
"json-stable-stringify": "^1.1.1",
|
|
57
67
|
"keyv": "^4.5.4",
|
|
58
68
|
"keyv-cached-with": "^0.0.13",
|
|
59
69
|
"lodash-es": "^4.17.21",
|
|
70
|
+
"lucide-react": "^0.408.0",
|
|
60
71
|
"mail-mime-builder": "^0.1.0",
|
|
61
72
|
"markdown-it": "^14.1.0",
|
|
62
73
|
"md5": "^2.3.0",
|
|
63
74
|
"minimist": "^1.2.8",
|
|
64
75
|
"monaco-editor": "^0.50.0",
|
|
65
|
-
"mongodb": "^6.
|
|
66
|
-
"next-auth": "^5.0.0-beta.
|
|
76
|
+
"mongodb": "^6.8.0",
|
|
77
|
+
"next-auth": "^5.0.0-beta.20",
|
|
67
78
|
"nodemailer": "^6.9.14",
|
|
68
79
|
"octokit": "^4.0.2",
|
|
69
80
|
"open": "^10.1.0",
|
|
81
|
+
"openai": "^4.53.2",
|
|
70
82
|
"p-map": "^7.0.2",
|
|
71
83
|
"peek-log": "^0.0.8",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
84
|
+
"polyfill-text-decoder-stream": "^0.0.9",
|
|
85
|
+
"polyfill-text-encoder-stream": "^0.0.8",
|
|
86
|
+
"pretty-ms": "^9.1.0",
|
|
87
|
+
"promise-all-properties": "^4.0.4",
|
|
74
88
|
"rambda": "^9.2.1",
|
|
75
89
|
"react-api-doc": "^0.0.9",
|
|
76
|
-
"react-hook-form": "^7.52.
|
|
90
|
+
"react-hook-form": "^7.52.1",
|
|
77
91
|
"react-hot-toast": "^2.4.1",
|
|
78
92
|
"react-markdown": "^9.0.1",
|
|
93
|
+
"sflow": "^1.16.17",
|
|
79
94
|
"snoflow": "^1.9.1",
|
|
80
95
|
"sparse-bitfield": "^3.0.3",
|
|
96
|
+
"tailwind-merge": "^2.4.0",
|
|
97
|
+
"tailwindcss-animate": "^1.0.7",
|
|
81
98
|
"toml": "^3.0.0",
|
|
82
99
|
"trpc-openapi": "^1.2.0",
|
|
83
100
|
"ts-pattern": "^5.2.0",
|
|
84
101
|
"unwind-array": "^1.1.4",
|
|
85
102
|
"use-swr-component": "^0.0.5",
|
|
86
|
-
"vercel": "^34.
|
|
87
|
-
"yaml": "^2.
|
|
103
|
+
"vercel": "^34.4.0",
|
|
104
|
+
"yaml": "^2.5.0",
|
|
88
105
|
"zod": "^3.23.8",
|
|
89
|
-
"zx": "^8.1.
|
|
106
|
+
"zx": "^8.1.4"
|
|
90
107
|
},
|
|
91
108
|
"devDependencies": {
|
|
92
|
-
"@types/bun": "^1.1.
|
|
109
|
+
"@types/bun": "^1.1.6",
|
|
93
110
|
"@types/js-yaml": "^4.0.9",
|
|
94
111
|
"@types/json-stable-stringify": "^1.0.36",
|
|
95
112
|
"@types/lodash-es": "^4.17.12",
|
|
96
113
|
"@types/md5": "^2.3.5",
|
|
97
114
|
"@types/minimist": "^1.2.5",
|
|
98
|
-
"@types/node": "^20",
|
|
115
|
+
"@types/node": "^20.14.13",
|
|
99
116
|
"@types/nodemailer": "^6.4.15",
|
|
100
|
-
"@types/react": "^18",
|
|
101
|
-
"@types/react-dom": "^18",
|
|
102
|
-
"eslint": "^8",
|
|
117
|
+
"@types/react": "^18.3.3",
|
|
118
|
+
"@types/react-dom": "^18.3.0",
|
|
119
|
+
"eslint": "^8.57.0",
|
|
103
120
|
"eslint-config-next": "14.2.4",
|
|
104
|
-
"next": "^14.2.
|
|
105
|
-
"postcss": "^8",
|
|
121
|
+
"next": "^14.2.5",
|
|
122
|
+
"postcss": "^8.4.40",
|
|
106
123
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
107
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
124
|
+
"prettier-plugin-packagejson": "^2.5.1",
|
|
108
125
|
"react": "^18.3.1",
|
|
109
126
|
"react-dom": "^18.3.1",
|
|
110
|
-
"tailwindcss": "^3.4.
|
|
127
|
+
"tailwindcss": "^3.4.7",
|
|
111
128
|
"ts-toolbelt": "^9.6.0",
|
|
112
|
-
"typescript": "^5.5.
|
|
129
|
+
"typescript": "^5.5.4"
|
|
113
130
|
},
|
|
114
131
|
"peerDependencies": {
|
|
115
132
|
"typescript": "^5.4.5"
|
package/src/Authors.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { type Task } from "@/packages/mongodb-pipeline-ts/Task";
|
|
2
|
-
import console from "console";
|
|
3
1
|
import { db } from "./db";
|
|
4
|
-
import {
|
|
5
|
-
import type { AwaitedReturnType } from "./types/AwaitedReturnType";
|
|
2
|
+
import type { GHUser } from "./ghUser";
|
|
6
3
|
import { updateAuthors } from "./updateAuthors";
|
|
7
4
|
export type Author = {
|
|
8
5
|
email?: string;
|
|
@@ -34,15 +31,12 @@ export type Author = {
|
|
|
34
31
|
};
|
|
35
32
|
|
|
36
33
|
export const Authors = db.collection<Author>("Authors");
|
|
37
|
-
await Authors.createIndex(
|
|
38
|
-
await Authors.createIndex(
|
|
39
|
-
export const GithubUsers = db.collection<
|
|
40
|
-
{ username: string } & Task<AwaitedReturnType<typeof gh.users.getByUsername>["data"]>
|
|
41
|
-
>("GithubUsers");
|
|
34
|
+
await Authors.createIndex("githubId");
|
|
35
|
+
await Authors.createIndex("email");
|
|
36
|
+
export const GithubUsers = db.collection<{ username: string } & GHUser>("GithubUsers");
|
|
42
37
|
|
|
43
38
|
if (import.meta.main) {
|
|
44
39
|
// collect github id from cn repos
|
|
45
40
|
await updateAuthors();
|
|
46
41
|
console.log("done");
|
|
47
42
|
}
|
|
48
|
-
|
package/src/CNRepos.ts
CHANGED
|
@@ -4,6 +4,7 @@ bun index.ts
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ObjectId, WithId } from "mongodb";
|
|
6
6
|
import "react-hook-form";
|
|
7
|
+
import { nil } from "sflow";
|
|
7
8
|
import { type Task } from "../packages/mongodb-pipeline-ts/Task";
|
|
8
9
|
import { type CMNode } from "./CMNodes";
|
|
9
10
|
import { type CRNode } from "./CRNodes";
|
|
@@ -25,6 +26,7 @@ type Sent = {
|
|
|
25
26
|
emails?: Email[];
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
// TODO: refactor into interface to improve performance
|
|
28
30
|
type GithubIssueComment = Awaited<ReturnType<typeof gh.issues.getComment>>["data"];
|
|
29
31
|
type GithubIssue = Awaited<ReturnType<typeof gh.issues.get>>["data"];
|
|
30
32
|
type GithubRepo = Awaited<ReturnType<typeof gh.repos.get>>["data"];
|
|
@@ -35,7 +37,7 @@ export type CRPull = RelatedPull & {
|
|
|
35
37
|
issue?: Task<Pick<GithubIssue, "number" | "html_url" | "body" | "updated_at">>;
|
|
36
38
|
emailTask_id?: ObjectId;
|
|
37
39
|
};
|
|
38
|
-
|
|
40
|
+
// TODO: refactor into interface to improve performance
|
|
39
41
|
export type CustomNodeRepo = {
|
|
40
42
|
repository: string;
|
|
41
43
|
info?: Task<Pick<GithubRepo, "html_url" | "archived" | "default_branch" | "private">>;
|
|
@@ -69,7 +71,8 @@ export type CustomNodeRepo = {
|
|
|
69
71
|
};
|
|
70
72
|
export type CNRepo = CustomNodeRepo;
|
|
71
73
|
export const CNRepos = db.collection<CNRepo>("CNRepos");
|
|
72
|
-
|
|
74
|
+
|
|
75
|
+
CNRepos.createIndex({ repository: 1 }, { unique: true }).catch(nil);
|
|
73
76
|
|
|
74
77
|
// fix cr null, it should be not exists
|
|
75
|
-
await CNRepos.updateMany({ cr: null as unknown as WithId<CRNode> }, { $unset: { cr: 1 } });
|
|
78
|
+
// await CNRepos.updateMany({ cr: null as unknown as WithId<CRNode> }, { $unset: { cr: 1 } });
|
package/src/EmailTasks.ts
CHANGED
|
@@ -22,12 +22,12 @@ export type EmailTask = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export const EmailTasks = db.collection<EmailTask>("EmailTasks");
|
|
25
|
-
|
|
26
25
|
await EmailTasks.createIndex({ from: 1, to: 1, subject: 1 });
|
|
27
26
|
|
|
28
27
|
if (import.meta.main) {
|
|
29
|
-
sf(EmailTasks.find())
|
|
30
|
-
|
|
28
|
+
sf(EmailTasks.find({}))
|
|
29
|
+
.map((e) => e.state)
|
|
30
|
+
.toLog();
|
|
31
31
|
// sf(EmailTasks.watch([], { fullDocument: "whenAvailable" }))
|
|
32
32
|
// // .filter((c) => c.operationType === "modify")
|
|
33
33
|
// .toLog()
|
|
@@ -49,6 +49,7 @@ if (import.meta.main) {
|
|
|
49
49
|
// console.log({ saved });
|
|
50
50
|
// await updateEmailTasks();
|
|
51
51
|
}
|
|
52
|
+
|
|
52
53
|
/**
|
|
53
54
|
* deduplicated by [from, to, subject].join(' ')
|
|
54
55
|
*/
|
package/src/addCommentAction.ts
CHANGED
|
@@ -33,7 +33,7 @@ export async function addCommentAction({
|
|
|
33
33
|
url: payload.url,
|
|
34
34
|
by: action.by,
|
|
35
35
|
body: action.body.replace(
|
|
36
|
-
/{{\$([_A-Za-z0-9]+)}}
|
|
36
|
+
/{{\$([_A-Za-z0-9]+)}}/g,
|
|
37
37
|
(_, key: string) =>
|
|
38
38
|
(payload as any)[key] || DIE("Missing key: " + key + " in payload: " + JSON.stringify(payload)),
|
|
39
39
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $pipeline } from "@/packages/mongodb-pipeline-ts/$pipeline";
|
|
1
|
+
import { $pipeline, type Pipeline } from "@/packages/mongodb-pipeline-ts/$pipeline";
|
|
2
2
|
import type { ObjectId } from "mongodb";
|
|
3
3
|
import prettyMs from "pretty-ms";
|
|
4
4
|
import { snoflow } from "snoflow";
|
|
@@ -39,6 +39,7 @@ if (import.meta.main) {
|
|
|
39
39
|
export type PullStatus = z.infer<typeof zPullStatus>;
|
|
40
40
|
export type PullsStatus = PullStatus[];
|
|
41
41
|
export type PullStatusShown = Awaited<ReturnType<typeof analyzePullsStatus>>[number];
|
|
42
|
+
|
|
42
43
|
export async function analyzePullsStatus({ skip = 0, limit = 0, pipeline = analyzePullsStatusPipeline() } = {}) {
|
|
43
44
|
"use server";
|
|
44
45
|
return await pipeline
|
|
@@ -53,12 +54,20 @@ export async function analyzePullsStatus({ skip = 0, limit = 0, pipeline = analy
|
|
|
53
54
|
pull_updated,
|
|
54
55
|
repo_updated,
|
|
55
56
|
...pull,
|
|
56
|
-
|
|
57
|
+
lastcomment: pull.lastcomment?.replace(/\s+/g, " ").replace(/\*\*\*.*/g, "..."),
|
|
57
58
|
};
|
|
58
59
|
})
|
|
59
60
|
.toArray();
|
|
60
61
|
}
|
|
61
|
-
export function baseCRPullStatusPipeline()
|
|
62
|
+
export function baseCRPullStatusPipeline(): Pipeline<
|
|
63
|
+
CRPull & {
|
|
64
|
+
repo: string;
|
|
65
|
+
on_registry: Task<boolean>;
|
|
66
|
+
type: string;
|
|
67
|
+
comments: GithubIssueComment[];
|
|
68
|
+
emailTask_id?: ObjectId;
|
|
69
|
+
}
|
|
70
|
+
> {
|
|
62
71
|
return (
|
|
63
72
|
$pipeline(CNRepos)
|
|
64
73
|
// get latest pr comments time
|
|
@@ -89,7 +98,24 @@ export function baseCRPullStatusPipeline() {
|
|
|
89
98
|
>()
|
|
90
99
|
);
|
|
91
100
|
}
|
|
92
|
-
export function analyzePullsStatusPipeline() {
|
|
101
|
+
export function analyzePullsStatusPipeline(): Pipeline<{
|
|
102
|
+
actived_at: Date;
|
|
103
|
+
email: string | "";
|
|
104
|
+
comments: number;
|
|
105
|
+
created_at: Date;
|
|
106
|
+
head: string;
|
|
107
|
+
lastcomment: string;
|
|
108
|
+
on_registry_at: Date;
|
|
109
|
+
on_registry: boolean;
|
|
110
|
+
comments_author: string;
|
|
111
|
+
ownername: string;
|
|
112
|
+
nickName: string;
|
|
113
|
+
repository: string;
|
|
114
|
+
state: "OPEN" | "MERGED" | "CLOSED";
|
|
115
|
+
updated_at: Date;
|
|
116
|
+
emailState: EmailTask["state"] | "";
|
|
117
|
+
url: string;
|
|
118
|
+
}> {
|
|
93
119
|
return (
|
|
94
120
|
baseCRPullStatusPipeline()
|
|
95
121
|
// fetch author email from Authors collection
|
|
@@ -112,14 +138,14 @@ export function analyzePullsStatusPipeline() {
|
|
|
112
138
|
as: "emailTask",
|
|
113
139
|
})
|
|
114
140
|
.unwind({ path: "$emailTask", preserveNullAndEmptyArrays: true })
|
|
115
|
-
.set({ emailState: "$emailTask.state" }) //could be
|
|
141
|
+
.set({ emailState: { $ifNull: ["$emailTask.state", ""] } }) // output could be "" | "waiting" | "sending" | "sent" | "error";
|
|
116
142
|
.with<{ emailState: EmailTask["state"] }>()
|
|
117
143
|
|
|
118
144
|
// .set({ author: { $first: ["$author"] } })
|
|
119
145
|
.project({ authors: 0 })
|
|
120
146
|
|
|
121
|
-
.set({
|
|
122
|
-
.set({
|
|
147
|
+
.set({ lastcomment: { $arrayElemAt: ["$comments", -1] } })
|
|
148
|
+
.set({ lastcomment: { $ifNull: [{ $concat: ["$lastcomment.user.login", ": ", "$lastcomment.body"] }, ""] } })
|
|
123
149
|
|
|
124
150
|
// calculate update_at max( )
|
|
125
151
|
// date format convert
|
|
@@ -153,8 +179,8 @@ export function analyzePullsStatusPipeline() {
|
|
|
153
179
|
chars: " ",
|
|
154
180
|
},
|
|
155
181
|
},
|
|
156
|
-
lastwords: 1,
|
|
157
182
|
actived_at: 1,
|
|
183
|
+
lastcomment: 1,
|
|
158
184
|
|
|
159
185
|
instagramId: "$author.instagramId",
|
|
160
186
|
discordId: "$author.discordId",
|
|
@@ -177,7 +203,7 @@ export function analyzePullsStatusPipeline() {
|
|
|
177
203
|
comments: number;
|
|
178
204
|
created_at: Date;
|
|
179
205
|
head: string;
|
|
180
|
-
|
|
206
|
+
lastcomment: string;
|
|
181
207
|
on_registry_at: Date;
|
|
182
208
|
on_registry: boolean;
|
|
183
209
|
comments_author: string;
|
|
@@ -186,7 +212,7 @@ export function analyzePullsStatusPipeline() {
|
|
|
186
212
|
repository: string;
|
|
187
213
|
state: "OPEN" | "MERGED" | "CLOSED";
|
|
188
214
|
updated_at: Date;
|
|
189
|
-
emailState: EmailTask["state"];
|
|
215
|
+
emailState: EmailTask["state"] | "";
|
|
190
216
|
url: string;
|
|
191
217
|
}>()
|
|
192
218
|
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isRepoBypassed } from "./bypassRepos";
|
|
2
|
+
|
|
3
|
+
it("bypass", async () => {
|
|
4
|
+
const bypassRepo = "https://github.com/loopyd/ComfyUI-FD-Tagger";
|
|
5
|
+
expect(isRepoBypassed(bypassRepo)).toBeTruthy();
|
|
6
|
+
});
|
|
7
|
+
it("allow", async () => {
|
|
8
|
+
const allowRepo = "https://github.com/snomiao/ComfyUI-FD-Tagger";
|
|
9
|
+
expect(isRepoBypassed(allowRepo)).toBeFalsy();
|
|
10
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { yaml } from "./utils/yaml";
|
|
3
|
+
|
|
4
|
+
export const bypassRepos = z
|
|
5
|
+
.string()
|
|
6
|
+
.array()
|
|
7
|
+
.parse(yaml.parse(await Bun.file("./bypass.yaml").text()).bypass_repos);
|
|
8
|
+
export const isRepoBypassed = (repo: string) => bypassRepos.some((reg) => repo.match(reg));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { $pipeline } from "@/packages/mongodb-pipeline-ts/$pipeline";
|
|
2
|
+
import { csvFormatBody } from "d3";
|
|
3
|
+
import sflow from "sflow";
|
|
4
|
+
import { CNRepos } from "./CNRepos";
|
|
5
|
+
|
|
6
|
+
if (import.meta.main) {
|
|
7
|
+
const pipeline = $pipeline(CNRepos)
|
|
8
|
+
.match({ "createdPulls.state": "error" })
|
|
9
|
+
.set({ error: "$createdPulls.error" })
|
|
10
|
+
.project({ _id: 0, repository: 1, error: 1 })
|
|
11
|
+
.as<{ repository: string; error: string }>()
|
|
12
|
+
.aggregate();
|
|
13
|
+
const csv = await sflow(pipeline)
|
|
14
|
+
.map((e, i) => ((!i && "repository,error\n") || "") + csvFormatBody([e]) + "\n")
|
|
15
|
+
.log()
|
|
16
|
+
.text();
|
|
17
|
+
await Bun.write(".cache/pr-errors.csv", csv);
|
|
18
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { makePublishcrBranch } from "./makePublishBranch";
|
|
2
2
|
import { makePyprojectBranch } from "./makeTomlBranch";
|
|
3
3
|
|
|
4
|
-
export async function clone_modify_push_Branches(
|
|
5
|
-
upstreamUrl: string,
|
|
6
|
-
forkUrl: string,
|
|
7
|
-
) {
|
|
4
|
+
export async function clone_modify_push_Branches(upstreamUrl: string, forkUrl: string) {
|
|
8
5
|
return (
|
|
9
6
|
await Promise.all([
|
|
10
7
|
makePyprojectBranch(upstreamUrl, forkUrl),
|
|
11
8
|
makePublishcrBranch(upstreamUrl, forkUrl),
|
|
9
|
+
// makeLicenseUpdateBranch(upstreamUrl, forkUrl),
|
|
12
10
|
])
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
branch,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
)
|
|
12
|
+
.flatMap((e) => (e ? [e] : []))
|
|
13
|
+
.map(({ body, branch, title, type }) => ({
|
|
14
|
+
body,
|
|
15
|
+
branch,
|
|
16
|
+
title,
|
|
17
|
+
type,
|
|
18
|
+
srcUrl: forkUrl,
|
|
19
|
+
dstUrl: upstreamUrl,
|
|
20
|
+
}));
|
|
21
21
|
}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import pMap from "p-map";
|
|
2
|
-
import yaml from "yaml";
|
|
3
2
|
// import { chalk } from "zx";
|
|
4
3
|
import { clone_modify_push_Branches } from "./clone_modify_push_Branches";
|
|
5
4
|
import { createGithubForkForRepo } from "./createGithubForkForRepo";
|
|
6
5
|
import { createGithubPullRequest } from "./createGithubPullRequest";
|
|
7
6
|
import type { GithubPull } from "./gh/GithubPull";
|
|
7
|
+
import { makeUpdateTomlLicenseBranch } from "./makeUpdateTomlLicenseBranch";
|
|
8
8
|
import { parsePulls } from "./parsePullsState";
|
|
9
9
|
|
|
10
10
|
export async function createComfyRegistryPullRequests(upstreamRepoUrl: string) {
|
|
11
11
|
const forkedRepo = await createGithubForkForRepo(upstreamRepoUrl);
|
|
12
|
+
|
|
12
13
|
const PR_REQUESTS = await clone_modify_push_Branches(upstreamRepoUrl, forkedRepo.html_url);
|
|
13
|
-
// branch is ready in fork now
|
|
14
|
-
// create prs for each branch
|
|
15
|
-
console.log("Going to create PRs for the following branches:");
|
|
16
|
-
// console.log(chalk.green(yaml.stringify({ PR_REQUESTS })));
|
|
17
|
-
console.log(yaml.stringify({ PR_REQUESTS }));
|
|
18
|
-
// prs
|
|
19
14
|
const prs = await pMap(PR_REQUESTS, async ({ type, ...prInfo }) => await createGithubPullRequest({ ...prInfo }));
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
|
|
16
|
+
console.log("Registry PRs DONE");
|
|
17
|
+
|
|
18
|
+
return ([...prs] as GithubPull[]).map((e) => parsePulls([e])[0]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function clone_modify_push_Branches_for_updateTomlLicense(upstreamUrl: string, forkUrl: string) {
|
|
22
|
+
return (await Promise.all([makeUpdateTomlLicenseBranch(upstreamUrl, forkUrl)]))
|
|
23
|
+
.flatMap((e) => (e ? [e] : []))
|
|
24
|
+
.map(({ body, branch, title, type }) => ({
|
|
25
|
+
body,
|
|
26
|
+
branch,
|
|
27
|
+
title,
|
|
28
|
+
type,
|
|
29
|
+
srcUrl: forkUrl,
|
|
30
|
+
dstUrl: upstreamUrl,
|
|
31
|
+
}));
|
|
22
32
|
}
|
|
@@ -7,6 +7,10 @@ import { createGithubFork } from "./gh/createGithubFork";
|
|
|
7
7
|
import { ghUser } from "./ghUser";
|
|
8
8
|
import { parseUrlRepoOwner } from "./parseOwnerRepo";
|
|
9
9
|
|
|
10
|
+
if (import.meta.main) {
|
|
11
|
+
console.log(await createGithubForkForRepo("https://github.com/comfyanonymous/ComfyUI_TensorRT"));
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* this function creates a fork of the upstream repo,
|
|
12
16
|
* fork to the FORK_OWNER, and add a prefix to the repo name
|
|
@@ -18,12 +22,27 @@ import { parseUrlRepoOwner } from "./parseOwnerRepo";
|
|
|
18
22
|
* @param upstreamRepoUrl
|
|
19
23
|
* @returns forked repo info
|
|
20
24
|
*/
|
|
21
|
-
export async function createGithubForkForRepo(
|
|
22
|
-
|
|
25
|
+
export async function createGithubForkForRepo(
|
|
26
|
+
upstreamRepoUrl: string,
|
|
27
|
+
{ forkUrl = createGithubForkUrlForRepo(upstreamRepoUrl) } = {},
|
|
28
|
+
) {
|
|
29
|
+
console.debug(
|
|
30
|
+
`
|
|
31
|
+
Forking ${upstreamRepoUrl}
|
|
32
|
+
into ${forkUrl}
|
|
33
|
+
`.trim(),
|
|
34
|
+
);
|
|
35
|
+
const forked = await createGithubFork(upstreamRepoUrl, forkUrl);
|
|
36
|
+
if (forked.html_url !== forkUrl)
|
|
37
|
+
DIE(
|
|
38
|
+
new Error(
|
|
39
|
+
"forked url not expected, it's likely you already forked this repo in your account before, and now trying to fork it again with different salt. To recovery you could delete that repo forked before by manual. (the repo forked before is listed in FORK OK: .....)",
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
return forked;
|
|
43
|
+
}
|
|
44
|
+
export function createGithubForkUrlForRepo(upstreamRepoUrl: string) {
|
|
23
45
|
// console.log(`* Change env.SALT=${salt} will fork into a different repo`);
|
|
24
|
-
// console.log("PR_SRC: ", forkSSHUrl);
|
|
25
|
-
// console.log("PR_DST: ", upstreamUrl);
|
|
26
|
-
// console.log(forkSSHUrl);
|
|
27
46
|
const upstream = parseUrlRepoOwner(upstreamRepoUrl);
|
|
28
47
|
const argv = minimist(process.argv.slice(2));
|
|
29
48
|
const salt = argv.salt || process.env.SALT || "m3KMgZ2AeZGWYh7W";
|
|
@@ -31,10 +50,5 @@ export async function createGithubForkForRepo(upstreamRepoUrl: string) {
|
|
|
31
50
|
const forkRepoName = (FORK_PREFIX && `${FORK_PREFIX}${upstream.repo}-${repo_hash}`) || upstream.repo;
|
|
32
51
|
const forkDst = `${FORK_OWNER}/${forkRepoName}`;
|
|
33
52
|
const forkUrl = `https://github.com/${forkDst}`;
|
|
34
|
-
|
|
35
|
-
if (forked.html_url !== forkUrl)
|
|
36
|
-
DIE(
|
|
37
|
-
"forked url not expected, it's likely you already forked this repo in your account before, and now trying to fork it again with different salt. To recovery you could delete that repo forked before by manual. (the repo forked before is listed in FORK OK: .....)",
|
|
38
|
-
);
|
|
39
|
-
return forked;
|
|
53
|
+
return forkUrl;
|
|
40
54
|
}
|