GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ci: add --discord-webhook / -d CLI option for custom Discord webhook URL · areai51/opencode@5dee332

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • script
    • beta.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎script/beta.ts‎

Copy file name to clipboardExpand all lines: script/beta.ts
+16-6Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bun
22

33
import { Script } from "@opencode-ai/script"
4+
import { parseArgs } from "util"
45

56
interface PR {
67
number: number
@@ -20,10 +21,10 @@ interface FailedPR {
2021
reason: string
2122
}
2223

23-
async function postToDiscord(failures: FailedPR[]) {
24-
const webhookUrl = process.env.DISCORD_ISSUES_WEBHOOK_URL
25-
if (!webhookUrl) {
26-
console.log("Warning: DISCORD_ISSUES_WEBHOOK_URL not set, skipping Discord notification")
24+
async function postToDiscord(failures: FailedPR[], webhookUrl?: string) {
25+
const url = webhookUrl || process.env.DISCORD_ISSUES_WEBHOOK_URL
26+
if (!url) {
27+
console.log("Warning: No Discord webhook URL provided, skipping notification")
2728
return
2829
}
2930

@@ -37,7 +38,7 @@ Please resolve these conflicts manually.`
3738

3839
const content = JSON.stringify({ content: message })
3940

40-
const response = await fetch(webhookUrl, {
41+
const response = await fetch(url, {
4142
method: "POST",
4243
headers: { "Content-Type": "application/json" },
4344
body: content,
@@ -51,6 +52,15 @@ Please resolve these conflicts manually.`
5152
}
5253

5354
async function main() {
55+
const { values } = parseArgs({
56+
args: Bun.argv.slice(2),
57+
options: {
58+
"discord-webhook": { type: "string", short: "d" },
59+
},
60+
})
61+
62+
const discordWebhook = values["discord-webhook"] as string | undefined
63+
5464
console.log("Fetching open PRs from team members...")
5565

5666
const allPrs: PR[] = []
@@ -145,7 +155,7 @@ async function main() {
145155
console.log(`Failed: ${failed.length} PRs`)
146156
failed.forEach((f) => console.log(` - PR #${f.number}: ${f.reason}`))
147157

148-
await postToDiscord(failed)
158+
await postToDiscord(failed, discordWebhook)
149159

150160
throw new Error(`${failed.length} PR(s) failed to merge. Check Discord for details.`)
151161
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.