Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(azure): add support for rebase-merge #33732

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ You may choose from these values:
- `fast-forward`, "fast-forwarding" the main branch reference, no new commits in the resultant tree
- `merge-commit`, create a new merge commit
- `rebase`, rewrite history as part of the merge, but usually keep the individual commits
- `rebase-merge`, create a new merge commit, but rebase the commits prior merging
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note here that it's Azure-only

- `squash`, flatten the commits that are being merged into a single new commit

Platforms may only support _some_ of these merge strategies.
Expand Down
9 changes: 8 additions & 1 deletion lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,14 @@ const options: RenovateOptions[] = [
description:
'The merge strategy to use when automerging PRs. Used only if `automergeType=pr`.',
type: 'string',
allowedValues: ['auto', 'fast-forward', 'merge-commit', 'rebase', 'squash'],
allowedValues: [
'auto',
'fast-forward',
'merge-commit',
'rebase',
'rebase-merge',
'squash',
],
default: 'auto',
supportedPlatforms: ['azure', 'bitbucket', 'gitea'],
},
Expand Down
1 change: 1 addition & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export type MergeStrategy =
| 'fast-forward'
| 'merge-commit'
| 'rebase'
| 'rebase-merge'
| 'squash';

// TODO: Proper typings
Expand Down
3 changes: 3 additions & 0 deletions lib/modules/platform/azure/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ describe('modules/platform/azure/index', () => {
${'fast-forward'}
${'merge-commit'}
${'rebase'}
${'rebase-merge'}
${'squash'}
`(
'should not call getMergeMethod when automergeStrategy is $automergeStrategy',
Expand Down Expand Up @@ -1076,6 +1077,7 @@ describe('modules/platform/azure/index', () => {
${'fast-forward'} | ${GitPullRequestMergeStrategy.Rebase}
${'merge-commit'} | ${GitPullRequestMergeStrategy.NoFastForward}
${'rebase'} | ${GitPullRequestMergeStrategy.Rebase}
${'rebase-merge'} | ${GitPullRequestMergeStrategy.RebaseMerge}
${'squash'} | ${GitPullRequestMergeStrategy.Squash}
`(
'should create PR with mergeStrategy $prMergeStrategy',
Expand Down Expand Up @@ -1728,6 +1730,7 @@ describe('modules/platform/azure/index', () => {
${'fast-forward'} | ${GitPullRequestMergeStrategy.Rebase}
${'merge-commit'} | ${GitPullRequestMergeStrategy.NoFastForward}
${'rebase'} | ${GitPullRequestMergeStrategy.Rebase}
${'rebase-merge'} | ${GitPullRequestMergeStrategy.RebaseMerge}
${'squash'} | ${GitPullRequestMergeStrategy.Squash}
`(
'should complete PR with mergeStrategy $prMergeStrategy',
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/azure/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ export function mapMergeStrategy(
return GitPullRequestMergeStrategy.Rebase;
case 'merge-commit':
return GitPullRequestMergeStrategy.NoFastForward;
case 'rebase-merge':
return GitPullRequestMergeStrategy.RebaseMerge;
case 'squash':
return GitPullRequestMergeStrategy.Squash;
default:
Expand Down
Loading