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 · bzbetty/opencode@e9e8d97

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
+42-2Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,50 @@ async function main() {
4141
for (const pr of prs) {
4242
console.log(`\nProcessing PR #${pr.number}: ${pr.title}`)
4343

44+
// Try to update PR branch via GitHub API (rebase onto base branch)
45+
console.log(` Attempting to rebase PR #${pr.number} via GitHub API...`)
46+
const updateBranch = await $`gh pr update-branch ${pr.number} --rebase`.nothrow()
47+
if (updateBranch.exitCode !== 0) {
48+
console.log(` Rebase failed for PR #${pr.number} (has conflicts)`)
49+
console.log(` Error: ${updateBranch.stderr}`)
50+
skipped.push({ number: pr.number, reason: "Rebase failed (conflicts)" })
51+
continue
52+
}
53+
54+
console.log(` Rebase initiated for PR #${pr.number}`)
55+
56+
// Wait for rebase to complete by polling PR state
57+
console.log(` Waiting for rebase to complete...`)
58+
let rebaseComplete = false
59+
let attempts = 0
60+
const maxAttempts = 30
61+
62+
while (!rebaseComplete && attempts < maxAttempts) {
63+
await Bun.sleep(2000) // Wait 2 seconds
64+
attempts++
65+
66+
const prCheck = await $`gh pr view ${pr.number} --json mergeStateStatus,headRefOid`.nothrow()
67+
if (prCheck.exitCode === 0) {
68+
const prData = JSON.parse(prCheck.stdout)
69+
// mergeStateStatus will be "clean" when rebase is complete and no conflicts
70+
if (prData.mergeStateStatus === "clean") {
71+
rebaseComplete = true
72+
console.log(` Rebase completed for PR #${pr.number}`)
73+
}
74+
}
75+
}
76+
77+
if (!rebaseComplete) {
78+
console.log(` Timeout waiting for rebase on PR #${pr.number}`)
79+
skipped.push({ number: pr.number, reason: "Timeout waiting for rebase" })
80+
continue
81+
}
82+
83+
// Fetch the rebased PR
4484
const fetchPR = await $`git fetch origin pull/${pr.number}/head:pr-${pr.number}`.nothrow()
4585
if (fetchPR.exitCode !== 0) {
46-
console.log(` Failed to fetch PR #${pr.number}, skipping`)
47-
skipped.push({ number: pr.number, reason: "Failed to fetch" })
86+
console.log(` Failed to fetch PR #${pr.number} after rebase, skipping`)
87+
skipped.push({ number: pr.number, reason: "Failed to fetch after rebase" })
4888
continue
4989
}
5090

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.