@@ -15,33 +15,18 @@ interface FailedPR {
1515 reason : string
1616}
1717
18- async function postToDiscord ( failures : FailedPR [ ] ) {
19- const webhookUrl = process . env . DISCORD_ISSUES_WEBHOOK_URL
20- if ( ! webhookUrl ) {
21- console . log ( "Warning: DISCORD_ISSUES_WEBHOOK_URL not set, skipping Discord notification" )
22- return
23- }
24-
25- const message = `**Beta Branch Merge Failures**
26-
27- The following team PRs failed to merge into the beta branch:
28-
29- ${ failures . map ( ( f ) => `- **#${ f . number } **: ${ f . title } - ${ f . reason } ` ) . join ( "\n" ) }
18+ async function commentOnPR ( prNumber : number , reason : string ) {
19+ const body = `⚠️ **Blocking Beta Release**
3020
31- Please resolve these conflicts manually.`
21+ This PR cannot be merged into the beta branch due to: ** ${ reason } **
3222
33- const content = JSON . stringify ( { content : message } )
23+ Please resolve this issue to include this PR in the next beta release.`
3424
35- const response = await fetch ( webhookUrl , {
36- method : "POST" ,
37- headers : { "Content-Type" : "application/json" } ,
38- body : content ,
39- } )
40-
41- if ( ! response . ok ) {
42- console . error ( "Failed to post to Discord:" , await response . text ( ) )
43- } else {
44- console . log ( "Posted failures to Discord" )
25+ try {
26+ await $ `gh pr comment ${ prNumber } --body ${ body } `
27+ console . log ( ` Posted comment on PR #${ prNumber } ` )
28+ } catch ( err ) {
29+ console . log ( ` Failed to post comment on PR #${ prNumber } : ${ err } ` )
4530 }
4631}
4732
@@ -91,6 +76,7 @@ async function main() {
9176 } catch ( err ) {
9277 console . log ( ` Failed to fetch: ${ err } ` )
9378 failed . push ( { number : pr . number , title : pr . title , reason : "Fetch failed" } )
79+ await commentOnPR ( pr . number , "Fetch failed" )
9480 continue
9581 }
9682
@@ -109,6 +95,7 @@ async function main() {
10995 await $ `git clean -fd`
11096 } catch { }
11197 failed . push ( { number : pr . number , title : pr . title , reason : "Merge conflicts" } )
98+ await commentOnPR ( pr . number , "Merge conflicts with dev branch" )
11299 continue
113100 }
114101
@@ -124,6 +111,7 @@ async function main() {
124111 } catch {
125112 console . log ( " Failed to stage changes" )
126113 failed . push ( { number : pr . number , title : pr . title , reason : "Staging failed" } )
114+ await commentOnPR ( pr . number , "Failed to stage changes" )
127115 continue
128116 }
129117
@@ -133,6 +121,7 @@ async function main() {
133121 } catch ( err ) {
134122 console . log ( ` Failed to commit: ${ err } ` )
135123 failed . push ( { number : pr . number , title : pr . title , reason : "Commit failed" } )
124+ await commentOnPR ( pr . number , "Failed to commit changes" )
136125 continue
137126 }
138127
@@ -147,10 +136,7 @@ async function main() {
147136 if ( failed . length > 0 ) {
148137 console . log ( `Failed: ${ failed . length } PRs` )
149138 failed . forEach ( ( f ) => console . log ( ` - PR #${ f . number } : ${ f . reason } ` ) )
150-
151- await postToDiscord ( failed )
152-
153- throw new Error ( `${ failed . length } PR(s) failed to merge. Check Discord for details.` )
139+ throw new Error ( `${ failed . length } PR(s) failed to merge` )
154140 }
155141
156142 console . log ( "\nForce pushing beta branch..." )
0 commit comments