comfy-pr 0.2.26 → 1.0.1

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.
Files changed (100) hide show
  1. package/README.md +258 -157
  2. package/bot/IdleWaiter.ts +31 -0
  3. package/bot/RestartManager.spec.ts +163 -0
  4. package/bot/RestartManager.ts +190 -0
  5. package/bot/WorkingTasksManager.spec.ts +154 -0
  6. package/bot/cli.ts +1171 -0
  7. package/bot/codesearch-ai-wip.ts +351 -0
  8. package/bot/error-collector.ts +133 -0
  9. package/bot/index.ts +14 -0
  10. package/bot/restart-example.ts +99 -0
  11. package/bot/slack-bolt.ts +688 -0
  12. package/bot/slack-bot.ts +1575 -0
  13. package/bot/state.ts +19 -0
  14. package/bot/templateLoader.test.ts +84 -0
  15. package/bot/templateLoader.ts +92 -0
  16. package/next.config.ts +26 -0
  17. package/package.json +161 -41
  18. package/post-summary.ts +44 -0
  19. package/src/Authors.ts +2 -2
  20. package/src/CMNodes.ts +3 -3
  21. package/src/CNRepos.ts +30 -7
  22. package/src/CRNodes.ts +11 -9
  23. package/src/CRPulls.ts +3 -0
  24. package/src/EmailTasks.ts +27 -9
  25. package/src/FORK_OWNER.ts +3 -1
  26. package/src/FollowRules.ts +3 -3
  27. package/src/GithubIssueComments.ts +1 -1
  28. package/src/Totals.ts +9 -8
  29. package/src/WorkerInstances.ts +31 -8
  30. package/src/addCommentAction.ts +19 -11
  31. package/src/analyzePullsStatus.ts +39 -17
  32. package/src/analyzeTotals.ts +19 -11
  33. package/src/bypassRepos.ts +6 -5
  34. package/src/checkPRsFailures.ts +13 -8
  35. package/src/cli.test.ts +2 -0
  36. package/src/cli.ts +1 -1
  37. package/src/constants.ts +2 -0
  38. package/src/createComfyRegistryPRsFromCandidates.ts +20 -12
  39. package/src/createComfyRegistryPullRequests.ts +35 -10
  40. package/src/createGithubForkForRepo.ts +36 -11
  41. package/src/createGithubPullRequest.ts +83 -33
  42. package/src/createIssueComment.ts +4 -4
  43. package/src/fetchComfyRegistryNodes.ts +34 -4
  44. package/src/fetchCurrentGeoInfo.ts +3 -1
  45. package/src/fetchRelatedPullWithComments.ts +1 -1
  46. package/src/fetchRepoDescriptionMap.ts +1 -4
  47. package/src/followRuleSchema.ts +10 -4
  48. package/src/getBranchWorkingDir.ts +3 -7
  49. package/src/getRepoWorkingDir.ts +2 -3
  50. package/src/gh.spec.ts +571 -0
  51. package/src/ghData.ts +13 -0
  52. package/src/ghPageFlow.ts +33 -0
  53. package/src/ghSubscriber.ts +76 -0
  54. package/src/ghUser.ts +28 -4
  55. package/src/index.ts +13 -4
  56. package/src/initializeFollowRules.ts +11 -4
  57. package/src/logger.spec.ts +95 -0
  58. package/src/logger.ts +46 -0
  59. package/src/makeGpl3LicenseBranch.ts +66 -0
  60. package/src/makePublishBranch.ts +21 -15
  61. package/src/makeTomlBranch.ts +48 -14
  62. package/src/makeUpdateTomlLicenseBranch.ts +40 -44
  63. package/src/matchRelatedPulls.ts +9 -4
  64. package/src/normalizeGithubUrl.spec.ts +131 -0
  65. package/src/normalizeGithubUrl.ts +64 -0
  66. package/src/parseIssueUrl.spec.ts +95 -0
  67. package/src/parseIssueUrl.ts +17 -3
  68. package/src/parseOwnerRepo.spec.ts +147 -0
  69. package/src/parseOwnerRepo.ts +8 -5
  70. package/src/parsePullsState.ts +2 -2
  71. package/src/parseTitleBodyOfMarkdown.ts +1 -1
  72. package/src/pickRepoInfo.ts +37 -0
  73. package/src/postSlackMessage.ts +5 -1
  74. package/src/preload.ts +30 -27
  75. package/src/readTemplateTitle.ts +1 -3
  76. package/src/sendEmailAction.ts +14 -10
  77. package/src/sendGmail.ts +3 -3
  78. package/src/updateAuthorsForGithub.ts +53 -35
  79. package/src/updateAuthorsFromCNRepo.ts +12 -5
  80. package/src/updateCMNodesDuplicationWarnings.ts +14 -9
  81. package/src/updateCMRepos.ts +1 -1
  82. package/src/updateCNRepos.ts +14 -14
  83. package/src/updateCNReposCRPullsComments.ts +7 -5
  84. package/src/updateCNReposInfo.ts +49 -40
  85. package/src/updateCNReposPRCandidate.ts +3 -3
  86. package/src/updateCNReposPulls.ts +9 -5
  87. package/src/updateCNReposPullsDashboard.ts +11 -9
  88. package/src/updateCNReposRelatedPulls.ts +3 -3
  89. package/src/updateCRNodes.ts +24 -5
  90. package/src/updateCRRepos.ts +1 -1
  91. package/src/updateComfyTotals.ts +7 -5
  92. package/src/updateFollowRuleSet.ts +17 -9
  93. package/src/updateOutdatedPullsTemplates.ts +61 -48
  94. package/src/updateSlackMessages.ts +8 -4
  95. package/tailwind.config.ts +7 -1
  96. package/next-env.d.ts +0 -5
  97. package/src/GIT_USEREMAIL.ts +0 -5
  98. package/src/GIT_USERNAME.ts +0 -9
  99. package/src/clone_modify_push_Branches.ts +0 -21
  100. package/src/tomlFillDescription.ts +0 -17
@@ -7,7 +7,7 @@ if (import.meta.main) {
7
7
  }
8
8
  export async function updateCRRepos() {
9
9
  await CRNodes.createIndex({ repo_id: 1 });
10
- return await pMap(CRNodes.find({ repo_id: { $exists: false } }), async (cr, i) => {
10
+ return await pMap(CRNodes.find({ repo_id: { $exists: false } }), async (cr, _i) => {
11
11
  const { repository, _id } = cr;
12
12
  await CNRepos.updateOne(
13
13
  { repository },
@@ -3,8 +3,8 @@ import YAML from "yaml";
3
3
  import { $OK, TaskError, TaskOK, tsmatch } from "../packages/mongodb-pipeline-ts/Task";
4
4
  import { Totals } from "./Totals";
5
5
  import { analyzeTotals } from "./analyzeTotals";
6
- import { $filaten, $fresh } from "./db";
7
- import { notifySlack } from "./slack/notifySlack";
6
+ import { $flatten, $fresh } from "./db";
7
+ import { notifySlack } from "@/lib/slack/notifySlack";
8
8
 
9
9
  if (import.meta.main) {
10
10
  await updateComfyTotals();
@@ -13,7 +13,9 @@ if (import.meta.main) {
13
13
  export async function updateComfyTotals({ notify = true, fresh = "30m" } = {}) {
14
14
  await Totals.createIndex({ today: 1, "totals.mtime": 1, "totals.state": 1 });
15
15
  const today = new Date().toISOString().split("T")[0];
16
- const cached = await Totals.findOne($filaten({ today, totals: { mtime: $fresh(fresh), ...$OK } }));
16
+ const cached = await Totals.findOne(
17
+ $flatten({ today, totals: { mtime: $fresh(fresh), ...$OK } }),
18
+ );
17
19
  if (cached?.totals?.state === "ok")
18
20
  return [
19
21
  tsmatch(cached.totals)
@@ -24,7 +26,7 @@ export async function updateComfyTotals({ notify = true, fresh = "30m" } = {}) {
24
26
 
25
27
  // notify if today is not already notify
26
28
  if (notify) {
27
- if (!(await Totals.findOne($filaten({ today, totals: { mtime: $fresh("1d"), ...$OK } }))))
29
+ if (!(await Totals.findOne($flatten({ today, totals: { mtime: $fresh("1d"), ...$OK } }))))
28
30
  // ignore today
29
31
  await match(totals)
30
32
  .with($OK, async (totals) => {
@@ -34,7 +36,7 @@ export async function updateComfyTotals({ notify = true, fresh = "30m" } = {}) {
34
36
  .otherwise(() => null);
35
37
  }
36
38
 
37
- const insertResult = await Totals.insertOne({ totals });
39
+ const _insertResult = await Totals.insertOne({ totals });
38
40
  return [
39
41
  tsmatch(totals)
40
42
  .with($OK, ({ data }) => data)
@@ -8,9 +8,9 @@ import { CNRepos } from "./CNRepos";
8
8
  import { FollowRuleSets } from "./FollowRules";
9
9
  import { addCommentAction } from "./addCommentAction";
10
10
  import { analyzePullsStatus, analyzePullsStatusPipeline } from "./analyzePullsStatus";
11
- import { $filaten } from "./db";
11
+ import { $flatten } from "./db";
12
12
  import { zAddCommentAction, zFollowUpRules, zSendEmailAction } from "./followRuleSchema";
13
- import { fetchIssueComments } from "./gh/fetchIssueComments";
13
+ import { fetchIssueComments } from "@/lib/github/fetchIssueComments";
14
14
  import { stringifyGithubRepoUrl } from "./parseOwnerRepo";
15
15
  import { parsePullUrl } from "./parsePullUrl";
16
16
  import { sendEmailAction } from "./sendEmailAction";
@@ -56,19 +56,23 @@ export async function updateFollowRuleSet({
56
56
  return await (async function () {
57
57
  if (enable === false) {
58
58
  await FollowRuleSets.updateOne({ name }, { $set: { enabled: false, yamlWhenEnabled: "" } });
59
- DIE`ruleset is disabled, no need to run`;
59
+ throw new Error("ruleset is disabled, no need to run");
60
60
  }
61
61
 
62
62
  // must parse while run, because the date in code is dynamic generated
63
63
  const rules = zFollowUpRules.parse(yaml.parse(code || DIE`yaml is empty`));
64
64
  // save if parse succ
65
65
  // await FollowRuleSets.updateOne({ name }, { $set: { yaml: code, rules } });
66
+
67
+ // todo: enhance performance
66
68
  const parseResult = await pMap(
67
69
  rules,
68
70
  async (rule) => {
69
71
  if (runAction) {
70
72
  // pre-fetch comments before run a rule -> match -> action, to prevent comment on a outdated pull state
71
- const preMatched = await analyzePullsStatus({ pipeline: analyzePullsStatusPipeline().match(rule.$match) })
73
+ const preMatched = await analyzePullsStatus({
74
+ pipeline: analyzePullsStatusPipeline().match(rule.$match),
75
+ })
72
76
  .then(TaskOK)
73
77
  .catch(TaskError);
74
78
 
@@ -82,15 +86,19 @@ export async function updateFollowRuleSet({
82
86
  const comments = await fetchIssueComments(repository, { number: pull_number })
83
87
  .then(TaskOK)
84
88
  .catch(TaskError);
85
- (
86
- await CNRepos.updateOne($filaten({ repository, crPulls: { data: { pull: { html_url } } } }), {
89
+ const updateResult = await CNRepos.updateOne(
90
+ $flatten({ repository, crPulls: { data: { pull: { html_url } } } }),
91
+ {
87
92
  $set: { "crPulls.data.$.comments": comments },
88
- })
89
- ).matchedCount ?? DIE("pre-matched comments is not found");
93
+ },
94
+ );
95
+ if (!updateResult.matchedCount) DIE("pre-matched comments is not found");
90
96
  });
91
97
  }
92
98
 
93
- const matched = await analyzePullsStatus({ pipeline: analyzePullsStatusPipeline().match(rule.$match) })
99
+ const matched = await analyzePullsStatus({
100
+ pipeline: analyzePullsStatusPipeline().match(rule.$match),
101
+ })
94
102
  .then(TaskOK)
95
103
  .catch(TaskError);
96
104
 
@@ -1,54 +1,55 @@
1
1
  import { $elemMatch } from "@/packages/mongodb-pipeline-ts/$elemMatch";
2
2
  import DIE from "@snomiao/die";
3
+ import gitDiff from "git-diff";
4
+ import isCI from "is-ci";
5
+ import stableStringify from "json-stable-stringify";
3
6
  import pMap from "p-map";
7
+ import sflow from "sflow";
4
8
  import { match } from "ts-pattern";
9
+ import { glob } from "zx";
5
10
  import { $OK, TaskError, TaskOK, tsmatch } from "../packages/mongodb-pipeline-ts/Task";
6
11
  import { CNRepos, type CRPull } from "./CNRepos";
7
- import { $filaten, $fresh, $stale } from "./db";
8
- import { gh } from "./gh";
9
- import { parsePull } from "./gh/parsePull";
12
+ import { $flatten, $stale } from "./db";
13
+ import { gh } from "@/lib/github";
14
+ import { parsePull } from "@/lib/github/parsePull";
10
15
  import { ghUser } from "./ghUser";
11
- import { parseUrlRepoOwner } from "./parseOwnerRepo";
16
+ import { parseGithubRepoUrl } from "./parseOwnerRepo";
12
17
  import { readTemplate } from "./readTemplateTitle";
13
- import { notifySlackLinks } from "./slack/notifySlackLinks";
18
+ import { notifySlackLinks } from "@/lib/slack/notifySlackLinks";
14
19
  import { tLog } from "./utils/tLog";
15
20
  if (import.meta.main) {
16
21
  await tLog("updateOutdatedPullsTemplates", updateOutdatedPullsTemplates);
22
+ if (isCI) process.exit(0);
17
23
  }
18
24
 
19
25
  export async function updateOutdatedPullsTemplates() {
20
- const pyproject = await readTemplate("add-toml.md");
21
- const publishcr = await readTemplate("add-action.md");
22
- const toml = await readTemplate("update-toml-license.md");
23
- const outdated_toml = await readTemplate("outdated/update-toml-license.md");
24
- const outdated_pyproject = await readTemplate("outdated/add-toml.md");
25
- const outdated_publishcr = await readTemplate("outdated/add-action.md");
26
- const outdated_pyproject_v2 = await readTemplate("outdated/add-toml-v2.md");
27
- const outdated_publishcr_v2 = await readTemplate("outdated/add-action-v2.md");
28
- const outdated_pyproject_v3 = await readTemplate("outdated/add-toml-v3.md");
29
- const outdated_publishcr_v3 = await readTemplate("outdated/add-action-v3.md");
30
- const outdated_pyproject_v4 = await readTemplate("outdated/add-toml-v4.md");
26
+ const pyproject = await readTemplate("./templates/add-toml.md");
27
+ const publishcr = await readTemplate("./templates/add-action.md");
28
+ // update toml license
29
+ const toml = await readTemplate("./templates/update-toml-license.md");
30
+ const outdated_toml = await readTemplate("./templates/outdated/update-toml-license.md");
31
+ // publishcr
32
+ const outdated_publishcr_templates = await sflow(
33
+ await glob("./templates/outdated/add-action*.md"),
34
+ )
35
+ .map((file) => readTemplate(file))
36
+ .toArray();
37
+ // pyproject
38
+ const outdated_pyproject_templates = await sflow(await glob("./templates/outdated/add-toml*.md"))
39
+ .map((file) => readTemplate(file))
40
+ .toArray();
41
+
31
42
  const outdateTitles = [
32
43
  outdated_toml.title,
33
- outdated_pyproject.title,
34
- outdated_publishcr.title,
35
- outdated_pyproject_v2.title,
36
- outdated_publishcr_v2.title,
37
- outdated_pyproject_v3.title,
38
- outdated_publishcr_v3.title,
39
- outdated_pyproject_v4.title,
44
+ ...outdated_publishcr_templates.map((e) => e.title),
45
+ ...outdated_pyproject_templates.map((e) => e.title),
40
46
  ];
41
47
  const outdateBodies = [
42
48
  outdated_toml.body,
43
- outdated_pyproject.body,
44
- outdated_publishcr.body,
45
- outdated_pyproject_v2.body,
46
- outdated_publishcr_v2.body,
47
- outdated_pyproject_v3.body,
48
- outdated_publishcr_v3.body,
49
- outdated_pyproject_v4.body,
49
+ ...outdated_publishcr_templates.map((e) => e.body),
50
+ ...outdated_pyproject_templates.map((e) => e.body),
50
51
  ];
51
-
52
+ console.log("Outdated PR templates: ", outdateTitles.length);
52
53
  // const templateOutdate = new Date("2024-06-13T09:02:56.630Z");
53
54
 
54
55
  await CNRepos.createIndex({
@@ -62,9 +63,9 @@ export async function updateOutdatedPullsTemplates() {
62
63
  });
63
64
  return await pMap(
64
65
  CNRepos.find(
65
- $filaten({
66
+ $flatten({
66
67
  crPulls: {
67
- mtime: $fresh("1h"), // retry if update fails
68
+ // mtime: $fresh("1h"), // retry if update fails
68
69
  data: $elemMatch({
69
70
  edited: {
70
71
  mtime: $stale("30m"), // retry if update fails
@@ -72,7 +73,7 @@ export async function updateOutdatedPullsTemplates() {
72
73
  error: { $nin: ["up to date", "body mismatch"] },
73
74
  },
74
75
  pull: {
75
- user: { login: ghUser.login },
76
+ user: { login: (await ghUser()).login },
76
77
  title: { $in: outdateTitles },
77
78
  body: { $in: outdateBodies },
78
79
  },
@@ -96,9 +97,9 @@ export async function updateOutdatedPullsTemplates() {
96
97
  // },
97
98
  // }),
98
99
  ),
99
- async (repo) => {
100
+ async (repo, i) => {
100
101
  const { repository } = repo;
101
- console.log("Updating PR templates for: " + repository);
102
+ console.log(i + " Updating PR templates for: " + repository);
102
103
  const crPulls = match(repo.crPulls)
103
104
  .with($OK, (e) => e.data)
104
105
  .otherwise(() => null)!;
@@ -106,28 +107,37 @@ export async function updateOutdatedPullsTemplates() {
106
107
  // edit CRPulls templates to latest
107
108
  const crPullsEdited = await pMap(
108
109
  crPulls,
109
- async (data, i): Promise<CRPull> => {
110
+ async (data, pullIndex): Promise<CRPull> => {
110
111
  const { pull, type } = data;
111
112
  const { number } = pull;
112
- if (pull.user.login !== ghUser.login) DIE("not editable");
113
+ if (pull.user.login !== (await ghUser()).login) DIE("not editable");
113
114
  const replacement = match(pull)
114
115
  .with(pyproject, () => DIE("Is already latest, should never happen here"))
115
116
  .with(publishcr, () => DIE("Is already latest, should never happen here"))
116
117
  .with(outdated_toml, () => toml)
117
- .with(outdated_pyproject, () => pyproject)
118
- .with(outdated_pyproject_v2, () => pyproject)
119
- .with(outdated_pyproject_v3, () => pyproject)
120
- .with(outdated_pyproject_v4, () => pyproject)
121
- .with(outdated_publishcr, () => publishcr)
122
- .with(outdated_publishcr_v2, () => publishcr)
123
- .with(outdated_publishcr_v3, () => publishcr)
118
+ .when(
119
+ (pull) =>
120
+ outdated_pyproject_templates
121
+ .map((e) => stableStringify(e))
122
+ .includes(stableStringify({ title: pull.title, body: pull.body })),
123
+ () => pyproject,
124
+ )
125
+ .when(
126
+ (pull) =>
127
+ outdated_publishcr_templates
128
+ .map((e) => stableStringify(e))
129
+ .includes(stableStringify({ title: pull.title, body: pull.body })),
130
+ () => publishcr,
131
+ )
124
132
  // in case author clicked some task as completed, body will be different, may cause template mismatch
125
133
  .otherwise(() => DIE("Template not found: " + pull.title));
126
134
  if (!replacement) return { ...data, edited: TaskError("Template mismatch") };
135
+ const diff = gitDiff(pull.body!, replacement.body);
136
+ console.log(diff);
127
137
 
128
138
  const edited = await gh.issues
129
139
  .update({
130
- ...parseUrlRepoOwner(repository),
140
+ ...parseGithubRepoUrl(repository),
131
141
  issue_number: number,
132
142
  ...(pull.title === replacement.title ? {} : { title: replacement.title }),
133
143
  ...(pull.body === replacement.body ? {} : { body: replacement.body }),
@@ -137,11 +147,14 @@ export async function updateOutdatedPullsTemplates() {
137
147
  .catch(TaskError);
138
148
  const updatedPull = (
139
149
  await gh.pulls.get({
140
- ...parseUrlRepoOwner(repository),
150
+ ...parseGithubRepoUrl(repository),
141
151
  pull_number: number,
142
152
  })
143
153
  ).data;
144
- await CNRepos.updateOne({ repository }, { $set: { [`crPulls.data.${i}.edited`]: edited } });
154
+ await CNRepos.updateOne(
155
+ { repository },
156
+ { $set: { [`crPulls.data.${pullIndex}.edited`]: edited } },
157
+ );
145
158
  return { pull: parsePull(updatedPull), type, edited };
146
159
  },
147
160
  { concurrency: 2 },
@@ -1,14 +1,17 @@
1
1
  import { $fresh, $stale } from "@/packages/mongodb-pipeline-ts";
2
- import { $filaten } from "@/packages/mongodb-pipeline-ts/$filaten";
2
+ import { $flatten } from "@/packages/mongodb-pipeline-ts/$flatten";
3
3
  import pMap from "p-map";
4
4
  import { postSlackMessage } from "./postSlackMessage";
5
- import { SlackMsgs } from "./slack/SlackMsgs";
5
+ import { SlackMsgs } from "@/lib/slack/SlackMsgs";
6
6
 
7
+ /**
8
+ * @deprecated use upsertSlackMessage instead
9
+ */
7
10
  export async function updateSlackMessages() {
8
11
  // send
9
12
  return await pMap(
10
13
  SlackMsgs.find(
11
- $filaten({
14
+ $flatten({
12
15
  $or: [
13
16
  { status: { $exists: false } },
14
17
  {
@@ -32,7 +35,8 @@ export async function updateSlackMessages() {
32
35
  }
33
36
  }
34
37
  console.log("SLACK POST MSG: " + JSON.stringify(text));
35
- if (silent) return await SlackMsgs.updateOne({ _id }, { $set: { status: "sent", mtime: new Date() } });
38
+ if (silent)
39
+ return await SlackMsgs.updateOne({ _id }, { $set: { status: "sent", mtime: new Date() } });
36
40
  const sent = await postSlackMessage(text)
37
41
  .then((e) => ({ ...e, error: undefined, status: "sent" as const }))
38
42
  .catch((e) => ({ error: e.message ?? String(e), status: "error" as const }));
@@ -2,7 +2,12 @@ import type { Config } from "tailwindcss";
2
2
 
3
3
  const config = {
4
4
  darkMode: ["class"],
5
- content: ["./pages/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}", "./src/**/*.{ts,tsx}"],
5
+ content: [
6
+ "./pages/**/*.{ts,tsx}",
7
+ "./components/**/*.{ts,tsx}",
8
+ "./app/**/*.{ts,tsx}",
9
+ "./src/**/*.{ts,tsx}",
10
+ ],
6
11
  prefix: "",
7
12
  theme: {
8
13
  container: {
@@ -70,6 +75,7 @@ const config = {
70
75
  },
71
76
  },
72
77
  plugins: [require("daisyui"), require("tailwindcss-animate")],
78
+ daisyui: { logs: false },
73
79
  } satisfies Config;
74
80
 
75
81
  export default config;
package/next-env.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/image-types/global" />
3
-
4
- // NOTE: This file should not be edited
5
- // see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -1,5 +0,0 @@
1
- import DIE from "@snomiao/die";
2
- import { ghUser } from "./ghUser";
3
-
4
- export const GIT_USEREMAIL =
5
- process.env.GIT_USEREMAIL || (ghUser.email && ghUser.email) || DIE("Missing env.GIT_USEREMAIL");
@@ -1,9 +0,0 @@
1
- import DIE from "@snomiao/die";
2
- import { GIT_USEREMAIL } from "./GIT_USEREMAIL";
3
- import { ghUser } from "./ghUser";
4
-
5
- export const GIT_USERNAME =
6
- process.env.GIT_USERNAME || (ghUser.email && ghUser.name) || DIE("Missing env.GIT_USERNAME");
7
-
8
- // read env/parameters
9
- console.log(`GIT COMMIT USER: ${GIT_USERNAME} <${GIT_USEREMAIL}>`);
@@ -1,21 +0,0 @@
1
- import { makePublishcrBranch } from "./makePublishBranch";
2
- import { makePyprojectBranch } from "./makeTomlBranch";
3
-
4
- export async function clone_modify_push_Branches(upstreamUrl: string, forkUrl: string) {
5
- return (
6
- await Promise.all([
7
- makePyprojectBranch(upstreamUrl, forkUrl),
8
- makePublishcrBranch(upstreamUrl, forkUrl),
9
- // makeLicenseUpdateBranch(upstreamUrl, forkUrl),
10
- ])
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
- }
@@ -1,17 +0,0 @@
1
- import { writeFile, readFile } from "fs/promises";
2
- import DIE from "@snomiao/die";
3
- import toml from "toml";
4
- import { fetchRepoDescriptionMap } from "./fetchRepoDescriptionMap";
5
-
6
- export async function tomlFillDescription(referenceUrl: string, pyprojectToml: string) {
7
- const repoDescriptionMap = await fetchRepoDescriptionMap();
8
- const matchedDescription = repoDescriptionMap[referenceUrl]?.toString() ||
9
- DIE("Warn: missing description for " + referenceUrl);
10
- const replaced = (await readFile(pyprojectToml, "utf8")).replace(
11
- `description = ""`,
12
- `description = ${JSON.stringify(matchedDescription)}`
13
- );
14
- // check validity
15
- toml.parse(replaced);
16
- await writeFile(pyprojectToml, replaced);
17
- }