Showing the changes to apps/server/src/pullRequest/gitLabMergeRequestJson.ts (1 of 34 files). Show all
Unified · Split
| @@ -11,6 +11,7 @@ import type { · 10 unmodified lines | |||
| 11 | PullRequestLabel, | 11 | PullRequestLabel, |
| 12 | PullRequestMergeability, | 12 | PullRequestMergeability, |
| 13 | PullRequestMergeCapabilities, | 13 | PullRequestMergeCapabilities, |
| 14 | PullRequestMergeMethod, | ||
| 14 | PullRequestReaction, | 15 | PullRequestReaction, |
| 15 | PullRequestReactionContent, | 16 | PullRequestReactionContent, |
| 16 | PullRequestReviewThread, | 17 | PullRequestReviewThread, |
| @@ -80,6 +81,9 @@ const RawMergeRequestSchema = Schema.Struct({ · 63 unmodified lines | |||
| 80 | */ | 81 | */ |
| 81 | merge_when_pipeline_succeeds: Schema.optional(Schema.NullOr(Schema.Boolean)), | 82 | merge_when_pipeline_succeeds: Schema.optional(Schema.NullOr(Schema.Boolean)), |
| 82 | auto_merge_enabled: Schema.optional(Schema.NullOr(Schema.Boolean)), | 83 | auto_merge_enabled: Schema.optional(Schema.NullOr(Schema.Boolean)), |
| 84 | /** The merge request's stored squash choice, including project-policy overrides. */ | ||
| 85 | squash_on_merge: Schema.optional(Schema.NullOr(Schema.Boolean)), | ||
| 86 | squash: Schema.optional(Schema.NullOr(Schema.Boolean)), | ||
| 83 | /** | 87 | /** |
| 84 | * How far the target branch has moved on since this one left it, which is the same number | 88 | * How far the target branch has moved on since this one left it, which is the same number |
| 85 | * GitLab's own "out of date" wording counts. It costs a walk of the two branches, so GitLab | 89 | * GitLab's own "out of date" wording counts. It costs a walk of the two branches, so GitLab |
| @@ -228,6 +232,8 @@ export interface GitLabMergeRequestDetail extends GitLabMergeRequestListItem { · 142 unmodified lines | |||
| 228 | readonly reviewerIds: ReadonlyArray<number>; | 232 | readonly reviewerIds: ReadonlyArray<number>; |
| 229 | /** Absent where GitLab named neither auto-merge field, which is not the same as off. */ | 233 | /** Absent where GitLab named neither auto-merge field, which is not the same as off. */ |
| 230 | readonly autoMergeEnabled?: boolean; | 234 | readonly autoMergeEnabled?: boolean; |
| 235 | /** GitLab only exposes the stored strategy separately when that strategy is squash. */ | ||
| 236 | readonly autoMergeMethod?: PullRequestMergeMethod; | ||
| 231 | /** | 237 | /** |
| 232 | * Absent where GitLab did not count, which is not the same as a branch that has nothing behind | 238 | * Absent where GitLab did not count, which is not the same as a branch that has nothing behind |
| 233 | * it: an install too old to answer must not be read as saying the branch is current. | 239 | * it: an install too old to answer must not be read as saying the branch is current. |
| @@ -379,6 +385,9 @@ function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLab · 145 unmodified lines | |||
| 379 | reviewer.id === undefined ? [] : [reviewer.id], | 385 | reviewer.id === undefined ? [] : [reviewer.id], |
| 380 | ), | 386 | ), |
| 381 | ...(autoMerge === undefined ? {} : { autoMergeEnabled: autoMerge }), | 387 | ...(autoMerge === undefined ? {} : { autoMergeEnabled: autoMerge }), |
| 388 | ...(autoMerge === true && raw.squash_on_merge === true | ||
| 389 | ? { autoMergeMethod: "squash" as const } | ||
| 390 | : {}), | ||
| 382 | ...(raw.diverged_commits_count == null ? {} : { divergedCommits: raw.diverged_commits_count }), | 391 | ...(raw.diverged_commits_count == null ? {} : { divergedCommits: raw.diverged_commits_count }), |
| 383 | }; | 392 | }; |
| 384 | } | 393 | } |