mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
ci: remove parseArgs CLI option and use environment variable directly
This commit is contained in:
parent
5dee3328d4
commit
e9f8e6aeec
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
|
|
||||||
import { Script } from "@opencode-ai/script"
|
import { Script } from "@opencode-ai/script"
|
||||||
import { parseArgs } from "util"
|
|
||||||
|
|
||||||
interface PR {
|
interface PR {
|
||||||
number: number
|
number: number
|
||||||
@ -21,10 +20,10 @@ interface FailedPR {
|
|||||||
reason: string
|
reason: string
|
||||||
}
|
}
|
||||||
|
|
||||||
async function postToDiscord(failures: FailedPR[], webhookUrl?: string) {
|
async function postToDiscord(failures: FailedPR[]) {
|
||||||
const url = webhookUrl || process.env.DISCORD_ISSUES_WEBHOOK_URL
|
const webhookUrl = process.env.DISCORD_ISSUES_WEBHOOK_URL
|
||||||
if (!url) {
|
if (!webhookUrl) {
|
||||||
console.log("Warning: No Discord webhook URL provided, skipping notification")
|
console.log("Warning: DISCORD_ISSUES_WEBHOOK_URL not set, skipping Discord notification")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ Please resolve these conflicts manually.`
|
|||||||
|
|
||||||
const content = JSON.stringify({ content: message })
|
const content = JSON.stringify({ content: message })
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(webhookUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: content,
|
body: content,
|
||||||
@ -52,15 +51,6 @@ Please resolve these conflicts manually.`
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const { values } = parseArgs({
|
|
||||||
args: Bun.argv.slice(2),
|
|
||||||
options: {
|
|
||||||
"discord-webhook": { type: "string", short: "d" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const discordWebhook = values["discord-webhook"] as string | undefined
|
|
||||||
|
|
||||||
console.log("Fetching open PRs from team members...")
|
console.log("Fetching open PRs from team members...")
|
||||||
|
|
||||||
const allPrs: PR[] = []
|
const allPrs: PR[] = []
|
||||||
@ -155,7 +145,7 @@ async function main() {
|
|||||||
console.log(`Failed: ${failed.length} PRs`)
|
console.log(`Failed: ${failed.length} PRs`)
|
||||||
failed.forEach((f) => console.log(` - PR #${f.number}: ${f.reason}`))
|
failed.forEach((f) => console.log(` - PR #${f.number}: ${f.reason}`))
|
||||||
|
|
||||||
await postToDiscord(failed, discordWebhook)
|
await postToDiscord(failed)
|
||||||
|
|
||||||
throw new Error(`${failed.length} PR(s) failed to merge. Check Discord for details.`)
|
throw new Error(`${failed.length} PR(s) failed to merge. Check Discord for details.`)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user