Skip to content

Commit

Permalink
Merge pull request release-drafter#462 from sergioflores-j/feature/ad…
Browse files Browse the repository at this point in the history
…d-body-output
  • Loading branch information
jetersen authored May 28, 2020
2 parents 4c46a77 + 06234d8 commit c907b4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ The Release Drafter GitHub Action sets a couple of outputs which can be used as
| `id` | The ID of the release that was created or updated. |
| `name` | The name of this release. |
| `tag_name` | The name of the tag associated with this release. |
| `body` | The body of the drafted release, useful if it needs to be included in files. |
| `html_url` | The URL users can navigate to in order to view the release. i.e. `https://github.com/octocat/Hello-World/releases/v1.0.0`. |
| `upload_url` | The URL for uploading assets to the release, which could be used by GitHub Actions for additional uses, for example the [`@actions/upload-release-asset GitHub Action`](https://www.github.com/actions/upload-release-asset). |

Expand Down
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,25 @@ module.exports = (app) => {
})
}

setActionOutput(createOrUpdateReleaseResponse)
setActionOutput(createOrUpdateReleaseResponse, releaseInfo)
})
}

function setActionOutput(releaseResponse) {
function setActionOutput(releaseResponse, { body }) {
const {
data: { id: releaseId, html_url: htmlUrl, upload_url: uploadUrl, tag_name: tagName, name: name },
data: {
id: releaseId,
html_url: htmlUrl,
upload_url: uploadUrl,
tag_name: tagName,
name: name,
},
} = releaseResponse
if (releaseId && Number.isInteger(releaseId))
core.setOutput('id', releaseId.toString())
if (htmlUrl) core.setOutput('html_url', htmlUrl)
if (uploadUrl) core.setOutput('upload_url', uploadUrl)
if (tagName) core.setOutput('tag_name', tagName)
if (name) core.setOutput('name', name)
core.setOutput('body', body)
}

0 comments on commit c907b4f

Please sign in to comment.