Skip to content

Commit 8470a00

Browse files
authored
Merge pull request #60 from Comfy-Org/sno-coreping
refactor(coreping): migrate from index.tsx to coreping.ts implementation
2 parents 87712d4 + cdc0a25 commit 8470a00

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.github/workflows/coreping.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- run: bun i
2626

2727
# Run CorePing task
28-
- run: bun app/tasks/coreping/index.tsx
28+
- run: bun app/tasks/coreping/coreping.ts
2929
timeout-minutes: 8
3030
env:
3131
GH_TOKEN_COMFY_PR: ${{ secrets.GH_TOKEN_COMFY_PR_BOT }}

app/tasks/coreping/index.tsx renamed to app/tasks/coreping/coreping.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ if (import.meta.main) {
111111
// Designed to be mon to sat, TIME CHECKING
112112
// Pacific Daylight Time
113113

114+
// drop everytime since outdated data is useless, we kept lastSlackmessage in Meta collection which is enough
115+
await ComfyCorePRs.drop();
116+
114117
console.log("start", import.meta.file);
115118
let freshCount = 0;
116119

@@ -240,7 +243,7 @@ if (import.meta.main) {
240243
const freshMsg = !freshCorePRs.length
241244
? ""
242245
: `and there are ${freshCorePRs.length} more fresh Core/Core-Important PRs.\n`;
243-
const notifyMessage = `Hey <@comfy>, Here's x${staleCorePRs.length} Core/Important PRs waiting your feedback!\n\n${staleCorePRsMessage}\n${freshMsg}\nSent from <CorePing> by <@snomiao> cc <@Yoland>`;
246+
const notifyMessage = `Hey <@comfy>, Here's x${staleCorePRs.length} Core/Important PRs waiting your feedback!\n\n${staleCorePRsMessage}\n${freshMsg}\nSent from CorePing.ts by <@snomiao> cc <@yoland>`;
244247
console.log(chalk.bgBlue(notifyMessage));
245248

246249
// TODO: update message with delete line when it's reviewed

app/tasks/gh-desktop-release-notification/upsertSlackMessage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ export async function upsertSlackMessage({
4848
}
4949
if (!channel) DIE(`No slack channel specified`);
5050

51-
if (process.env.DRY_RUN) throw new Error("sending slack message: " + JSON.stringify({ text, channel, url }));
52-
5351
if (!url) {
52+
if (process.env.DRY_RUN) throw new Error("sending slack message: " + JSON.stringify({ text, channel }));
5453
const thread_ts = !replyUrl ? undefined : slackMessageUrlParse(replyUrl).ts;
5554
const msg = !thread_ts
5655
? await slack.chat.postMessage({ text, channel })
@@ -59,6 +58,7 @@ export async function upsertSlackMessage({
5958
const url = slackMessageUrlStringify({ channel, ts: msg.ts! });
6059
return { ...msg, url, text, channel };
6160
}
61+
if (process.env.DRY_RUN) throw new Error("updating slack message: " + JSON.stringify({ text, channel, url }));
6262
const ts = slackMessageUrlParse(url).ts;
6363
const msg = await slack.chat.update({ text, channel, ts });
6464
return { ...msg, url, text, channel };

0 commit comments

Comments
 (0)