ci: centralize team list in @opencode-ai/script package and use beta label filter
This commit is contained in:
@@ -46,6 +46,20 @@ const VERSION = await (async () => {
|
|||||||
return `${major}.${minor}.${patch + 1}`
|
return `${major}.${minor}.${patch + 1}`
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
const team = [
|
||||||
|
"actions-user",
|
||||||
|
"opencode",
|
||||||
|
"rekram1-node",
|
||||||
|
"thdxr",
|
||||||
|
"kommander",
|
||||||
|
"jayair",
|
||||||
|
"fwang",
|
||||||
|
"adamdotdevin",
|
||||||
|
"iamdavidhill",
|
||||||
|
"opencode-agent[bot]",
|
||||||
|
"R44VC0RP",
|
||||||
|
]
|
||||||
|
|
||||||
export const Script = {
|
export const Script = {
|
||||||
get channel() {
|
get channel() {
|
||||||
return CHANNEL
|
return CHANNEL
|
||||||
@@ -59,5 +73,8 @@ export const Script = {
|
|||||||
get release() {
|
get release() {
|
||||||
return env.OPENCODE_RELEASE
|
return env.OPENCODE_RELEASE
|
||||||
},
|
},
|
||||||
|
get team() {
|
||||||
|
return team
|
||||||
|
},
|
||||||
}
|
}
|
||||||
console.log(`opencode script`, JSON.stringify(Script, null, 2))
|
console.log(`opencode script`, JSON.stringify(Script, null, 2))
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
|
|
||||||
import { $ } from "bun"
|
import { $ } from "bun"
|
||||||
import { Script } from "@opencode-ai/script"
|
|
||||||
|
|
||||||
interface PR {
|
interface PR {
|
||||||
number: number
|
number: number
|
||||||
@@ -32,28 +31,12 @@ Please resolve this issue to include this PR in the next beta release.`
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log("Fetching open PRs with beta label from team members...")
|
console.log("Fetching open PRs with beta label...")
|
||||||
|
|
||||||
const allPrs: PR[] = []
|
const stdout = await $`gh pr list --state open --label beta --json number,title,author,labels --limit 100`.text()
|
||||||
for (const member of Script.team) {
|
const prs: PR[] = JSON.parse(stdout)
|
||||||
try {
|
|
||||||
const stdout =
|
|
||||||
await $`gh pr list --state open --author ${member} --label beta --json number,title,author,labels --limit 100`.text()
|
|
||||||
const memberPrs: PR[] = JSON.parse(stdout)
|
|
||||||
allPrs.push(...memberPrs)
|
|
||||||
} catch {
|
|
||||||
// Skip member on error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const seen = new Set<number>()
|
console.log(`Found ${prs.length} open PRs with beta label`)
|
||||||
const prs = allPrs.filter((pr) => {
|
|
||||||
if (seen.has(pr.number)) return false
|
|
||||||
seen.add(pr.number)
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(`Found ${prs.length} open PRs with beta label from team members`)
|
|
||||||
|
|
||||||
if (prs.length === 0) {
|
if (prs.length === 0) {
|
||||||
console.log("No team PRs to merge")
|
console.log("No team PRs to merge")
|
||||||
|
|||||||
@@ -3,20 +3,7 @@
|
|||||||
import { $ } from "bun"
|
import { $ } from "bun"
|
||||||
import { createOpencode } from "@opencode-ai/sdk/v2"
|
import { createOpencode } from "@opencode-ai/sdk/v2"
|
||||||
import { parseArgs } from "util"
|
import { parseArgs } from "util"
|
||||||
|
import { Script } from "@opencode-ai/script"
|
||||||
export const team = [
|
|
||||||
"actions-user",
|
|
||||||
"opencode",
|
|
||||||
"rekram1-node",
|
|
||||||
"thdxr",
|
|
||||||
"kommander",
|
|
||||||
"jayair",
|
|
||||||
"fwang",
|
|
||||||
"adamdotdevin",
|
|
||||||
"iamdavidhill",
|
|
||||||
"opencode-agent[bot]",
|
|
||||||
"R44VC0RP",
|
|
||||||
]
|
|
||||||
|
|
||||||
type Release = {
|
type Release = {
|
||||||
tag_name: string
|
tag_name: string
|
||||||
@@ -191,7 +178,7 @@ export async function generateChangelog(commits: Commit[], opencode: Awaited<Ret
|
|||||||
for (let i = 0; i < commits.length; i++) {
|
for (let i = 0; i < commits.length; i++) {
|
||||||
const commit = commits[i]!
|
const commit = commits[i]!
|
||||||
const section = getSection(commit.areas)
|
const section = getSection(commit.areas)
|
||||||
const attribution = commit.author && !team.includes(commit.author) ? ` (@${commit.author})` : ""
|
const attribution = commit.author && !Script.team.includes(commit.author) ? ` (@${commit.author})` : ""
|
||||||
const entry = `- ${summaries[i]}${attribution}`
|
const entry = `- ${summaries[i]}${attribution}`
|
||||||
|
|
||||||
if (!grouped.has(section)) grouped.set(section, [])
|
if (!grouped.has(section)) grouped.set(section, [])
|
||||||
@@ -222,7 +209,7 @@ export async function getContributors(from: string, to: string) {
|
|||||||
const title = message.split("\n")[0] ?? ""
|
const title = message.split("\n")[0] ?? ""
|
||||||
if (title.match(/^(ignore:|test:|chore:|ci:|release:)/i)) continue
|
if (title.match(/^(ignore:|test:|chore:|ci:|release:)/i)) continue
|
||||||
|
|
||||||
if (login && !team.includes(login)) {
|
if (login && !Script.team.includes(login)) {
|
||||||
if (!contributors.has(login)) contributors.set(login, new Set())
|
if (!contributors.has(login)) contributors.set(login, new Set())
|
||||||
contributors.get(login)!.add(title)
|
contributors.get(login)!.add(title)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user