-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Comfy-Org/mass-pr
Mass pr
- Loading branch information
Showing
27 changed files
with
424 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: updateGithubActionTask | ||
on: | ||
schedule: | ||
- cron: "0 */2 * * *" # Runs every 2 hours | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- mass-pr | ||
paths: | ||
- ".github/workflows/*" | ||
- "src/*.ts" | ||
jobs: | ||
run_comfy_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# this dont need python | ||
# # setup comfy-cli | ||
# - uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: "3.x" | ||
# - run: python -m pip install --upgrade pip | ||
# - run: python -m venv .venv | ||
# - run: source .venv/bin/activate | ||
# - run: pip install comfy-cli | ||
# Setup SSH Key for git push | ||
- uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
# Setup Bun | ||
# - run: pip install setuptools | ||
- uses: oven-sh/setup-bun@v1 | ||
# Run Comfy-PR Worker | ||
- run: bun i | ||
- run: bun src/GithubActionUpdateTask/updateGithubActionTask.ts | ||
env: | ||
COMFY_PR_REPO: ${{ secrets.COMFY_PR_REPO }} | ||
FORK_OWNER: "ComfyNodePRs" | ||
FORK_PREFIX: "PR-" | ||
GH_TOKEN_COMFY_PR: ${{ secrets.GH_TOKEN_COMFY_PR }} | ||
MONGODB_URI: ${{ secrets.MONGODB_URI }} | ||
SLACK_BOT_CHANNEL: ${{ secrets.SLACK_BOT_CHANNEL }} | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
AUTH_GOOGLE_ID: ${{ secrets.AUTH_GOOGLE_ID }} | ||
AUTH_GOOGLE_SECRET: ${{ secrets.AUTH_GOOGLE_SECRET }} | ||
AUTH_GCLOUD_URL: https://comfy-pr.vercel.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use server"; | ||
import { $pipeline } from "@/packages/mongodb-pipeline-ts/$pipeline"; | ||
import { Totals } from "@/src/Totals"; | ||
import { flatten } from "flat"; | ||
import sf from "sflow"; | ||
|
||
export async function getTotalsData() { | ||
return sf( | ||
$pipeline(Totals) | ||
.match({ "totals.data": { $exists: true } }) | ||
.match({ "totals.mtime": { $gt: new Date(+new Date() - 86400e3 * 30) } }) // 1 month | ||
.set({ "totals.data.date": "$totals.mtime" }) | ||
.replaceRoot({ newRoot: "$totals.data" }) | ||
.aggregate(), | ||
) | ||
.map((e) => flatten(e) as { date: string } & Record<string, number>) | ||
.limit(3000) | ||
.toArray(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,7 @@ | |
.tasks-panel a:hover { | ||
@apply underline; | ||
} | ||
|
||
.btn[aria-busy=true] { | ||
@apply loading; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"use client"; | ||
import "is-hotkey-esm"; | ||
import { isHotkey } from "is-hotkey-esm"; | ||
import { useRouter } from "next/navigation"; | ||
import { useActionState, useEffect } from "react"; | ||
import { approveGithubActionUpdateTaskAction } from "./actions"; | ||
export function ApprovePRButton(e: { repo: string; branchVersionHash?: string }) { | ||
const [state, formAction, pending] = useActionState(approveGithubActionUpdateTaskAction, { ok: false }); | ||
const router = useRouter(); | ||
useEffect(() => { | ||
if (state.ok) router.refresh(); | ||
}, [state.ok, router]); | ||
return ( | ||
<form action={formAction} className="contents"> | ||
<input type="hidden" name="repo" value={e.repo} /> | ||
<input type="hidden" name="branchVersionHash" value={e.branchVersionHash} /> | ||
|
||
<button | ||
disabled={pending || !!state.ok} | ||
aria-busy={pending} | ||
className="btn btn-approve" | ||
title="will perform on next run" | ||
onKeyDown={(e) => { | ||
const mv = (offset: number) => { | ||
const btns = [...document.querySelectorAll("button.btn-approve")] as HTMLButtonElement[]; | ||
btns[btns.indexOf(e.currentTarget) + offset]?.focus(); | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}; | ||
if (isHotkey("ArrowUp")(e)) mv(-1); | ||
if (isHotkey("ArrowDown")(e)) mv(1); | ||
}} | ||
> | ||
{!state.ok ? <>Approve PR</> : <>APPROVED</>} | ||
</button> | ||
</form> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
"use client"; | ||
|
||
import { EChart } from "@kbox-labs/react-echarts"; | ||
|
||
// import ReactECharts from "echarts-for-react"; // or var ReactECharts = require('echarts-for-react'); | ||
/** | ||
* | ||
* @author: snomiao <[email protected]> | ||
*/ | ||
export default function ProgressBarChart({ data }: { data: readonly [string, number, string][] }) { | ||
return ( | ||
<> | ||
<EChart | ||
style={{ | ||
height: "100px", | ||
width: "100%", | ||
}} | ||
// xAxis={[ | ||
// { | ||
// type: "time", | ||
// axisLabel: { | ||
// formatter: function (value) { | ||
// return new Date(value).toISOString().slice(0, 10); | ||
// }, | ||
// }, | ||
// }, | ||
// ]} | ||
// yAxis={{ | ||
// type: "value", | ||
// }} | ||
// series={uniq(totalsData.flatMap((e) => Object.keys(omit("date", e)))).map((key) => ({ | ||
// type: "line", | ||
// data: totalsData.map((e) => [e.date, e[key] ?? null]), | ||
// }))} | ||
{...{ | ||
tooltip: { | ||
trigger: "axis", | ||
axisPointer: { | ||
type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow' | ||
}, | ||
}, | ||
legend: {}, | ||
grid: { | ||
left: "0", | ||
right: "0", | ||
bottom: "0", | ||
containLabel: false, | ||
}, | ||
xAxis: { | ||
type: "value", | ||
}, | ||
yAxis: { | ||
type: "category", | ||
data: ["Progress"], | ||
}, | ||
series: data.map(([name, value, color]) => ({ | ||
name, | ||
type: "bar", | ||
stack: "total", | ||
label: { | ||
show: true, | ||
}, | ||
color, | ||
emphasis: { | ||
focus: "series", | ||
}, | ||
data: [value], | ||
})), | ||
}} | ||
/> | ||
{/* <ReactECharts | ||
// option={this.getOption()} | ||
notMerge={true} | ||
lazyUpdate={true} | ||
theme={"theme_name"} | ||
// onChartReady={this.onChartReadyCallback} | ||
// onEvents={EventsDict} | ||
// opts={} | ||
// data={ | ||
// } | ||
/> */} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use client"; | ||
import "is-hotkey-esm"; | ||
import { isHotkey } from "is-hotkey-esm"; | ||
import { useRouter } from "next/navigation"; | ||
import { useActionState, useEffect } from "react"; | ||
import { resetGithubActionUpdateTaskAction } from "./actions"; | ||
export function ResetTaskButton(e: { repo: string }) { | ||
const [state, formAction, pending] = useActionState(resetGithubActionUpdateTaskAction, { ok: false }); | ||
const router = useRouter(); | ||
useEffect(() => { | ||
if (state.ok) router.refresh(); | ||
}, [state.ok, router]); | ||
return ( | ||
<form action={formAction} className="contents"> | ||
<input type="hidden" name="repo" value={e.repo} /> | ||
|
||
<button | ||
disabled={pending || !!state.ok} | ||
aria-busy={pending || undefined} | ||
className="btn btn-reset" | ||
title="will perform on next run" | ||
onKeyDown={(e) => { | ||
const mv = (offset: number) => { | ||
const btns = [...document.querySelectorAll("button.btn-reset")] as HTMLButtonElement[]; | ||
btns[btns.indexOf(e.currentTarget) + offset]?.focus(); | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}; | ||
if (isHotkey("ArrowUp")(e)) mv(-1); | ||
if (isHotkey("ArrowDown")(e)) mv(1); | ||
}} | ||
> | ||
{!state.ok ? <>RESET</> : <>RESET OK</>} | ||
</button> | ||
</form> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
ee9a86f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
comfy-pr – ./
comfy-pr-drip-ai.vercel.app
comfy-pr-git-main-drip-ai.vercel.app
comfy-pr.vercel.app