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@9cf3e65

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
+31-3Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ interface PR {
55
title: string
66
}
77

8+
interface Repo {
9+
nameWithOwner: string
10+
}
11+
12+
interface HeadRepo {
13+
nameWithOwner: string
14+
}
15+
16+
interface PRHead {
17+
headRefName: string
18+
headRepository: HeadRepo
19+
}
20+
821
async function main() {
922
console.log("Fetching open contributor PRs...")
1023

@@ -16,6 +29,12 @@ async function main() {
1629
const prs: PR[] = JSON.parse(prsResult.stdout)
1730
console.log(`Found ${prs.length} open contributor PRs`)
1831

32+
const repoResult = await $`gh repo view --json nameWithOwner`.nothrow()
33+
if (repoResult.exitCode !== 0) {
34+
throw new Error(`Failed to fetch repo info: ${repoResult.stderr}`)
35+
}
36+
const repo: Repo = JSON.parse(repoResult.stdout)
37+
1938
console.log("Fetching latest dev branch...")
2039
const fetchDev = await $`git fetch origin dev`.nothrow()
2140
if (fetchDev.exitCode !== 0) {
@@ -34,9 +53,18 @@ async function main() {
3453
for (const pr of prs) {
3554
console.log(`\nProcessing PR #${pr.number}: ${pr.title}`)
3655

37-
// Get the diff from GitHub
56+
const headResult = await $`gh pr view ${pr.number} --json headRefName,headRepository`.nothrow()
57+
if (headResult.exitCode !== 0) {
58+
console.log(` Failed to get head info`)
59+
skipped.push({ number: pr.number, reason: `Failed to get head info: ${headResult.stderr}` })
60+
continue
61+
}
62+
const head: PRHead = JSON.parse(headResult.stdout)
63+
64+
// Get the diff from GitHub compare API
3865
console.log(` Getting diff...`)
39-
const diffResult = await $`gh pr diff ${pr.number}`.nothrow()
66+
const compare = `${repo.nameWithOwner}/compare/dev...${head.headRepository.nameWithOwner}:${head.headRefName}`
67+
const diffResult = await $`gh api -H Accept:application/vnd.github.v3.diff repos/${compare}`.nothrow()
4068
if (diffResult.exitCode !== 0) {
4169
console.log(` Failed to get diff`)
4270
skipped.push({ number: pr.number, reason: `Failed to get diff: ${diffResult.stderr}` })
@@ -80,7 +108,7 @@ async function main() {
80108
const commitMsg = `Apply PR #${pr.number}: ${pr.title}`
81109
const commit = await $`git commit -m ${commitMsg}`.nothrow()
82110
if (commit.exitCode !== 0) {
83-
console.log(` Failed to commit`)
111+
console.log(` Failed to commit: ${commit.stderr}`)
84112
await $`git checkout -- .`.nothrow()
85113
await $`git clean -fd`.nothrow()
86114
skipped.push({ number: pr.number, reason: `Commit failed: ${commit.stderr}` })

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.