File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1215,7 +1215,9 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
12151215 return this . updateBranchWithGraphQL ( ) ;
12161216 }
12171217
1218- // When there are conflicts, use the REST API approach with conflict resolution
1218+ // For Conflict state, use the REST API approach with conflict resolution.
1219+ // For Unknown or NotMergeable states, the REST API approach will also be used as a fallback,
1220+ // though these states may fail for other reasons (e.g., blocked by branch protection).
12191221 return this . updateBranchWithConflictResolution ( model ) ;
12201222 }
12211223
@@ -1225,6 +1227,12 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
12251227 */
12261228 private async updateBranchWithGraphQL ( ) : Promise < boolean > {
12271229 Logger . debug ( `Updating branch using GraphQL UpdatePullRequestBranch mutation - enter` , GitHubRepository . ID ) ;
1230+
1231+ if ( ! this . head ?. sha ) {
1232+ Logger . error ( `Cannot update branch: head SHA is not available` , GitHubRepository . ID ) ;
1233+ return false ;
1234+ }
1235+
12281236 try {
12291237 const { mutate, schema } = await this . githubRepository . ensure ( ) ;
12301238
@@ -1233,7 +1241,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
12331241 variables : {
12341242 input : {
12351243 pullRequestId : this . graphNodeId ,
1236- expectedHeadOid : this . head ? .sha
1244+ expectedHeadOid : this . head . sha
12371245 }
12381246 }
12391247 } ) ;
You can’t perform that action at this time.
0 commit comments