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

Add auto-merge manifest option #34

Merged
merged 16 commits into from
Sep 21, 2023

Conversation

dgellow
Copy link
Member

@dgellow dgellow commented Sep 14, 2023

This pull request adds an autoMerge manifest option that can be passed to the factory fromManifest(). When set, release-please attempts to enable auto-merge for release pull requests.

Note that auto-merge can only be enabled on a pull request with branch protections (such as required reviewers, required CI checks, etc).

@dgellow
Copy link
Member Author

dgellow commented Sep 14, 2023

I forgot to add a check for minor/patch, from what I understood auto-merge should only be for non-breaking changes.

src/github.ts Outdated Show resolved Hide resolved
src/github.ts Outdated Show resolved Hide resolved
src/github.ts Outdated Show resolved Hide resolved
@rattrayalex
Copy link
Member

I believe my primary comments have been resolved, I think this is good to ship!

Copy link
Member

@rattrayalex rattrayalex left a comment

Choose a reason for hiding this comment

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

Sorry for the churn; let's do the more granular commit message filtering in this PR so we don't generate too many spam releases based on internal/minor changes, per Robert's comment here.

@dgellow dgellow force-pushed the sam/sta-2296-auto-merge-release-prs-when-possible branch from 21f5ee7 to 53b0d1b Compare September 15, 2023 17:58
@dgellow dgellow requested a review from rattrayalex September 21, 2023 17:24
src/manifest.ts Outdated Show resolved Hide resolved
Comment on lines +4798 to +4802
autoMerge: {
mergeMethod: 'rebase',
versionBumpFilter: ['minor'],
conventionalCommitFilter: [{type: 'fix', scope: 'api'}],
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we define filters.

test/manifest.ts Outdated
Comment on lines 4888 to 4929
sinon.assert.calledWith(
createPullRequestStub,
sinon.match.has(
'headBranchName',
'release-please/branches/main/components/a'
),
'main',
'main',
sinon.match.string,
sinon.match.array,
sinon.match({
autoMerge: undefined,
})
);
sinon.assert.calledWith(
createPullRequestStub,
sinon.match.has(
'headBranchName',
'release-please/branches/main/components/b'
),
'main',
'main',
sinon.match.string,
sinon.match.array,
sinon.match({
autoMerge: {mergeMethod: 'rebase'},
})
);
sinon.assert.calledWith(
createPullRequestStub,
sinon.match.has(
'headBranchName',
'release-please/branches/main/components/c'
),
'main',
'main',
sinon.match.string,
sinon.match.array,
sinon.match({
autoMerge: undefined,
})
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Asserts for the autoMerge parameter when github.createPullRequest() is called.

@dgellow dgellow enabled auto-merge (rebase) September 21, 2023 17:34
Comment on lines +5298 to +5304
autoMerge: {
mergeMethod: 'rebase',
conventionalCommitFilter: [
{type: 'fix'},
{type: 'feat', scope: 'api'},
],
},
Copy link
Member Author

Choose a reason for hiding this comment

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

@rattrayalex That's the config I expect Stainless to be using.

Copy link
Member

@rattrayalex rattrayalex left a comment

Choose a reason for hiding this comment

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

I haven't done careful code review of the contents of the recent commits, but the core stuff sounds good to me and I think the meat of the code was previously reviewed!

@marcel-stainless may want to give it another look over, I'm not sure, but probably okay to fast-follow with fixes that come out of that.

@dgellow dgellow merged commit 600b303 into main Sep 21, 2023
5 checks passed
@dgellow dgellow deleted the sam/sta-2296-auto-merge-release-prs-when-possible branch September 22, 2023 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants