@@ -51,6 +51,8 @@ const RawMergeRequestSchema = Schema.Struct({
5151 author : Schema . optional ( Schema . NullOr ( RawUserSchema ) ) ,
5252 source_branch : Schema . String ,
5353 target_branch : Schema . String ,
54+ /** The source branch's head commit. */
55+ sha : Schema . optional ( Schema . NullOr ( Schema . String ) ) ,
5456 state : Schema . optional ( Schema . NullOr ( Schema . String ) ) ,
5557 draft : Schema . optional ( Schema . Boolean ) ,
5658 work_in_progress : Schema . optional ( Schema . Boolean ) ,
@@ -240,6 +242,8 @@ export interface GitLabMergeRequestDetail extends GitLabMergeRequestListItem {
240242 * it: an install too old to answer must not be read as saying the branch is current.
241243 */
242244 readonly divergedCommits ?: number ;
245+ /** Absent where GitLab did not report the head commit. */
246+ readonly headSha ?: string ;
243247}
244248
245249function trimmed ( value : string | null | undefined ) : string | null {
@@ -365,6 +369,7 @@ function toListItem(
365369
366370function toDetail ( raw : Schema . Schema . Type < typeof RawMergeRequestSchema > ) : GitLabMergeRequestDetail {
367371 const listItem = toListItem ( raw ) ;
372+ const headSha = trimmed ( raw . sha ) ;
368373 const autoMerge =
369374 raw . merge_when_pipeline_succeeds == null && raw . auto_merge_enabled == null
370375 ? undefined
@@ -390,6 +395,7 @@ function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLab
390395 ? { autoMergeMethod : "squash" as const }
391396 : { } ) ,
392397 ...( raw . diverged_commits_count == null ? { } : { divergedCommits : raw . diverged_commits_count } ) ,
398+ ...( headSha === null ? { } : { headSha } ) ,
393399 } ;
394400}
395401
0 commit comments