Skip to content

Commit d353280

Browse files
authored
Merge pull request #85 from alexyaroshuk/daily-pr-conflicts
update daily-pr-conflicts.ts
2 parents 0ec280b + d2e58c9 commit d353280

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

script/daily-pr-conflicts.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ async function checkPRStatus(pr: PR, retries = 3): Promise<{ updatable: boolean;
4343
return { updatable: false, hasConflict: false }
4444
}
4545

46-
async function updatePR(pr: PR): Promise<boolean> {
46+
async function updatePR(pr: PR): Promise<{ success: boolean; error?: string }> {
4747
try {
4848
await $`gh pr update-branch ${pr.number} --repo ${REPO}`.quiet()
49-
return true
50-
} catch {
51-
return false
49+
return { success: true }
50+
} catch (e: any) {
51+
const stderr = e?.stderr?.toString() || ""
52+
const stdout = e?.stdout?.toString() || ""
53+
return { success: false, error: stderr || stdout || "Unknown error" }
5254
}
5355
}
5456

@@ -98,12 +100,12 @@ async function main() {
98100

99101
if (status.updatable) {
100102
process.stdout.write("updating... ")
101-
const success = await updatePR(pr)
102-
if (success) {
103+
const result = await updatePR(pr)
104+
if (result.success) {
103105
console.log("✅ Updated")
104106
updated.push(pr)
105107
} else {
106-
console.log("❌ Failed")
108+
console.log(`❌ Failed: ${result.error}`)
107109
}
108110
} else if (status.hasConflict) {
109111
console.log("❌ Has conflicts")

0 commit comments

Comments
 (0)