@@ -281,9 +281,10 @@ export const OfferToUpdate = ({ mergeable, isSimple, isCurrentlyCheckedOut, canU
281281
282282} ;
283283
284- export const ReadyForReview = ( { isSimple } : { isSimple : boolean } ) => {
284+ export const ReadyForReview = ( { isSimple, showMergeButton , mergeMethod } : { isSimple : boolean ; showMergeButton ?: boolean ; mergeMethod ?: MergeMethod } ) => {
285285 const [ isBusy , setBusy ] = useState ( false ) ;
286- const { readyForReview, updatePR } = useContext ( PullRequestContext ) ;
286+ const [ isMergeBusy , setMergeBusy ] = useState ( false ) ;
287+ const { readyForReview, readyForReviewAndMerge, updatePR } = useContext ( PullRequestContext ) ;
287288
288289 const markReadyForReview = useCallback ( async ( ) => {
289290 try {
@@ -295,6 +296,16 @@ export const ReadyForReview = ({ isSimple }: { isSimple: boolean }) => {
295296 }
296297 } , [ setBusy , readyForReview , updatePR ] ) ;
297298
299+ const markReadyAndMerge = useCallback ( async ( ) => {
300+ try {
301+ setMergeBusy ( true ) ;
302+ const result = await readyForReviewAndMerge ( { mergeMethod : mergeMethod || 'squash' } ) ;
303+ updatePR ( result ) ;
304+ } finally {
305+ setMergeBusy ( false ) ;
306+ }
307+ } , [ setMergeBusy , readyForReviewAndMerge , updatePR , mergeMethod ] ) ;
308+
298309 return (
299310 < div className = "ready-for-review-container" >
300311 < div className = 'ready-for-review-text-wrapper' >
@@ -305,7 +316,18 @@ export const ReadyForReview = ({ isSimple }: { isSimple: boolean }) => {
305316 </ div >
306317 </ div >
307318 < div className = 'button-container' >
308- < button disabled = { isBusy } onClick = { markReadyForReview } > Ready for Review</ button >
319+ < button disabled = { isBusy || isMergeBusy } onClick = { markReadyForReview } > Ready for Review</ button >
320+ { showMergeButton && (
321+ < button
322+ className = "secondary"
323+ disabled = { isBusy || isMergeBusy }
324+ onClick = { markReadyAndMerge }
325+ title = "Mark as ready for review, approve, and enable auto-merge with squash"
326+ aria-label = "Ready for Review, Approve, and Auto-Merge"
327+ >
328+ Ready & Merge
329+ </ button >
330+ ) }
309331 </ div >
310332 </ div >
311333 ) ;
@@ -338,10 +360,16 @@ export const Merge = (pr: PullRequest) => {
338360} ;
339361
340362export const PrActions = ( { pr, isSimple } : { pr : PullRequest ; isSimple : boolean } ) => {
341- const { hasWritePermission, canEdit, isDraft, mergeable } = pr ;
363+ const { hasWritePermission, canEdit, isDraft, mergeable, isCopilotOnMyBehalf , mergeMethodsAvailability } = pr ;
342364 if ( isDraft ) {
343365 // Only PR author and users with push rights can mark draft as ready for review
344- return canEdit ? < ReadyForReview isSimple = { isSimple } /> : null ;
366+ if ( ! canEdit ) {
367+ return null ;
368+ }
369+
370+ // For Copilot-created PRs, show the "Ready & Merge" button alongside the regular button
371+ const showMergeButton = isCopilotOnMyBehalf && mergeMethodsAvailability . squash ;
372+ return < ReadyForReview isSimple = { isSimple } showMergeButton = { showMergeButton } mergeMethod = "squash" /> ;
345373 }
346374
347375 if ( mergeable === PullRequestMergeability . Mergeable && hasWritePermission && ! pr . mergeQueueEntry ) {
0 commit comments