Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions script/beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function build() {
console.log(" Running final build smoke check...")

try {
await $`./script/build.ts --single`.cwd("packages/opencode")
await $`./script/build.ts --single`.cwd("packages/cli")
return true
} catch (err) {
console.log(`Build failed: ${err}`)
Expand Down Expand Up @@ -200,7 +200,7 @@ async function smoke(prs: PR[], applied: number[]) {
"The beta merge batch is complete, but the deterministic final smoke check failed.",
`Merged PRs on HEAD:\n${done}`,
"Run `bun typecheck` at the repo root.",
"Run `./script/build.ts --single` in `packages/opencode`.",
"Run `./script/build.ts --single` in `packages/cli`.",
"Fix any merge-caused issues until both commands pass.",
"Do not create a commit.",
].join("\n")
Expand All @@ -216,25 +216,27 @@ async function smoke(prs: PR[], applied: number[]) {
return commitSmokeChanges()
}

async function checkout() {
console.log("Fetching latest v2 branch...")
await $`git fetch origin v2`

console.log("Checking out beta branch...")
await $`git checkout -B beta origin/v2`

console.log("Installing v2 dependencies...")
await $`bun install --frozen-lockfile`
}

async function main() {
console.log("Fetching open PRs with beta label...")

const stdout =
await $`gh pr list --state open --draft=false --label beta --json number,title,author,labels --limit 100`.text()
await $`gh pr list --state open --draft=false --base v2 --label beta --json number,title,author,labels --limit 100`.text()
const prs: PR[] = JSON.parse(stdout).sort((a: PR, b: PR) => a.number - b.number)

console.log(`Found ${prs.length} open PRs with beta label`)

if (prs.length === 0) {
console.log("No team PRs to merge")
return
}

console.log("Fetching latest dev branch...")
await $`git fetch origin dev`

console.log("Checking out beta branch...")
await $`git checkout -B beta origin/dev`
await checkout()

const applied: number[] = []
const failed: FailedPR[] = []
Expand Down Expand Up @@ -262,7 +264,7 @@ async function main() {
if (!(await fix(pr, files, prs, applied, idx))) {
await cleanup()
failed.push({ number: pr.number, title: pr.title, reason: "Merge conflicts" })
await commentOnPR(pr.number, "Merge conflicts with dev branch")
await commentOnPR(pr.number, "Merge conflicts with v2 branch")
continue
}
} else {
Expand Down Expand Up @@ -318,7 +320,7 @@ async function main() {
await $`git fetch origin beta`

const localTree = (await $`git rev-parse beta^{tree}`.text()).trim()
const remoteTrees = (await $`git log origin/dev..origin/beta --format=%T`.text()).split("\n")
const remoteTrees = (await $`git log origin/v2..origin/beta --format=%T`.text()).split("\n")

const matchIdx = remoteTrees.indexOf(localTree)
if (matchIdx !== -1) {
Expand All @@ -335,7 +337,7 @@ async function main() {
await $`git fetch origin beta`

const validatedTree = (await $`git rev-parse beta^{tree}`.text()).trim()
const remoteTreesAfterSmoke = (await $`git log origin/dev..origin/beta --format=%T`.text()).split("\n")
const remoteTreesAfterSmoke = (await $`git log origin/v2..origin/beta --format=%T`.text()).split("\n")
const matchIdxAfterSmoke = remoteTreesAfterSmoke.indexOf(validatedTree)
if (matchIdxAfterSmoke !== -1) {
if (matchIdxAfterSmoke !== 0) {
Expand Down
Loading