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(release-please): add default branch input option for github release #206

Merged
Merged
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
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ async function main () {
monorepoTags,
token,
changelogPath,
releaseType
releaseType,
defaultBranch
})
const releaseCreated = await gr.createRelease()
if (releaseCreated) {
Expand Down
29 changes: 23 additions & 6 deletions test/release-please.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ describe('release-please-action', () => {
upload_url: 'http://example.com',
tag_name: 'v1.0.0'
})
let ReleaseStub = sinon.stub()
action.getGitHubRelease = () => {
class Release {}
Release.prototype.createRelease = createRelease
return Release
class Release {
createRelease () {}
}
ReleaseStub = sinon.spy(function () {
const instance = sinon.createStubInstance(Release)
instance.createRelease = createRelease
return instance
})
return ReleaseStub
}
const releasePR = sinon.stub().returns(25)
const buildStatic = sinon.stub().returns({
Expand All @@ -36,6 +43,7 @@ describe('release-please-action', () => {
}
await action.main()
sinon.assert.calledOnce(createRelease)
sinon.assert.calledWith(ReleaseStub, sinon.match.hasOwn('defaultBranch', undefined))
sinon.assert.calledWith(buildStatic, 'node', sinon.match.hasOwn('defaultBranch', undefined))
sinon.assert.calledOnce(releasePR)
assert.deepStrictEqual(output, {
Expand All @@ -62,10 +70,18 @@ describe('release-please-action', () => {
upload_url: 'http://example.com',
tag_name: 'v1.0.0'
})

let ReleaseStub = sinon.stub()
action.getGitHubRelease = () => {
class Release {}
Release.prototype.createRelease = createRelease
return Release
class Release {
createRelease () {}
}
ReleaseStub = sinon.spy(function () {
const instance = sinon.createStubInstance(Release)
instance.createRelease = createRelease
return instance
})
return ReleaseStub
}
const releasePR = sinon.stub().returns(25)
const buildStatic = sinon.stub().returns({
Expand All @@ -78,6 +94,7 @@ describe('release-please-action', () => {
}
await action.main()
sinon.assert.calledOnce(createRelease)
sinon.assert.calledWith(ReleaseStub, sinon.match.hasOwn('defaultBranch', 'dev'))
sinon.assert.calledWith(buildStatic, 'node', sinon.match.hasOwn('defaultBranch', 'dev'))
sinon.assert.calledOnce(releasePR)
assert.deepStrictEqual(output, {
Expand Down