chore: build beta from v2 (#41627)
This commit is contained in:
+18
-16
@@ -86,7 +86,7 @@ async function build() {
|
|||||||
console.log(" Running final build smoke check...")
|
console.log(" Running final build smoke check...")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await $`./script/build.ts --single`.cwd("packages/opencode")
|
await $`./script/build.ts --single`.cwd("packages/cli")
|
||||||
return true
|
return true
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Build failed: ${err}`)
|
console.log(`Build failed: ${err}`)
|
||||||
@@ -200,7 +200,7 @@ async function smoke(prs: PR[], applied: number[]) {
|
|||||||
"The beta merge batch is complete, but the deterministic final smoke check failed.",
|
"The beta merge batch is complete, but the deterministic final smoke check failed.",
|
||||||
`Merged PRs on HEAD:\n${done}`,
|
`Merged PRs on HEAD:\n${done}`,
|
||||||
"Run `bun typecheck` at the repo root.",
|
"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.",
|
"Fix any merge-caused issues until both commands pass.",
|
||||||
"Do not create a commit.",
|
"Do not create a commit.",
|
||||||
].join("\n")
|
].join("\n")
|
||||||
@@ -216,25 +216,27 @@ async function smoke(prs: PR[], applied: number[]) {
|
|||||||
return commitSmokeChanges()
|
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() {
|
async function main() {
|
||||||
console.log("Fetching open PRs with beta label...")
|
console.log("Fetching open PRs with beta label...")
|
||||||
|
|
||||||
const stdout =
|
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)
|
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`)
|
console.log(`Found ${prs.length} open PRs with beta label`)
|
||||||
|
|
||||||
if (prs.length === 0) {
|
await checkout()
|
||||||
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`
|
|
||||||
|
|
||||||
const applied: number[] = []
|
const applied: number[] = []
|
||||||
const failed: FailedPR[] = []
|
const failed: FailedPR[] = []
|
||||||
@@ -262,7 +264,7 @@ async function main() {
|
|||||||
if (!(await fix(pr, files, prs, applied, idx))) {
|
if (!(await fix(pr, files, prs, applied, idx))) {
|
||||||
await cleanup()
|
await cleanup()
|
||||||
failed.push({ number: pr.number, title: pr.title, reason: "Merge conflicts" })
|
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
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -318,7 +320,7 @@ async function main() {
|
|||||||
await $`git fetch origin beta`
|
await $`git fetch origin beta`
|
||||||
|
|
||||||
const localTree = (await $`git rev-parse beta^{tree}`.text()).trim()
|
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)
|
const matchIdx = remoteTrees.indexOf(localTree)
|
||||||
if (matchIdx !== -1) {
|
if (matchIdx !== -1) {
|
||||||
@@ -335,7 +337,7 @@ async function main() {
|
|||||||
await $`git fetch origin beta`
|
await $`git fetch origin beta`
|
||||||
|
|
||||||
const validatedTree = (await $`git rev-parse beta^{tree}`.text()).trim()
|
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)
|
const matchIdxAfterSmoke = remoteTreesAfterSmoke.indexOf(validatedTree)
|
||||||
if (matchIdxAfterSmoke !== -1) {
|
if (matchIdxAfterSmoke !== -1) {
|
||||||
if (matchIdxAfterSmoke !== 0) {
|
if (matchIdxAfterSmoke !== 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user