1
0
mirror of https://github.com/joaquinjsb/gitea-release-please-action synced 2026-05-13 19:11:36 +02:00

fix: do not set PR output, if no PR opened (#129)

This commit is contained in:
Benjamin E. Coe
2020-12-07 11:37:47 -05:00
committed by GitHub
parent 985c763f4a
commit b0faf1dd7d
3 changed files with 3898 additions and 22 deletions

View File

@@ -61,7 +61,9 @@ async function main () {
versionFile versionFile
}) })
const pr = await release.run() const pr = await release.run()
core.setOutput('pr', pr) if (pr) {
core.setOutput('pr', pr)
}
} }
} }

3886
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ describe('release-please-action', () => {
Release.prototype.createRelease = createRelease Release.prototype.createRelease = createRelease
return Release return Release
} }
const releasePR = sinon.stub() const releasePR = sinon.stub().returns(25)
action.getReleasePRFactory = () => { action.getReleasePRFactory = () => {
return { return {
buildStatic: () => { buildStatic: () => {
@@ -42,7 +42,7 @@ describe('release-please-action', () => {
release_created: true, release_created: true,
upload_url: 'http://example.com', upload_url: 'http://example.com',
tag_name: 'v1.0.0', tag_name: 'v1.0.0',
pr: undefined pr: 25
}) })
}) })
@@ -187,4 +187,30 @@ describe('release-please-action', () => {
await action.main() await action.main()
assert.strictEqual(output.pr, 95) assert.strictEqual(output.pr, 95)
}) })
it('does not set PR output, when no release PR is returned', async () => {
const output = {}
core.setOutput = (name, value) => {
output[name] = value
}
const input = {
'release-type': 'node',
command: 'release-pr'
}
core.getInput = (name) => {
return input[name]
}
const releasePR = sinon.stub().returns(undefined)
action.getReleasePRFactory = () => {
return {
buildStatic: () => {
return {
run: releasePR
}
}
}
}
await action.main()
assert.strictEqual(Object.hasOwnProperty.call(output, 'pr'), false)
})
}) })