Skip to content

Commit

Permalink
feat(release-please): add default branch input option for github rele…
Browse files Browse the repository at this point in the history
…ase (#206)
  • Loading branch information
pragmaticivan committed Feb 5, 2021
1 parent 61a3f25 commit 534536c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion index.js
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
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

0 comments on commit 534536c

Please sign in to comment.