Include body parameter for release
Fixes #4 This adds the ability to include the body parameter when creating the release. - name: Checkout code uses: actions/checkout@master - name: Create Release id: create_release uses: actions/create-release@master with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} body: Release body This also supports a multiline body: - name: Create Release id: create_release uses: actions/create-release@master with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} body: | This is a multiline body with more than one line Or if you want the contents of a file: - name: Read CHANGELOG id: changelog run: | echo "::set-output name=body::$(cat CHANGELOG.md)" - name: Create Release id: create_release uses: actions/create-release@master with: release_name: Release ${{ github.ref }} body: ${{ steps.changelog.outputs.body }} One decision I made in favor of less code was to send an empty body when there was non present. If it would be preferred to send nothing in the request for the `body` attribute I could instead compose the parameters with an optional body attribute: releaseParams = { owner, repo, tag_name: tag, name: releaseName, draft, prerelease }; if (body) releaseParams.body = body; const createReleaseResponse = await github.repos.createRelease( releaseParams );
This commit is contained in:
@@ -15,6 +15,7 @@ async function run() {
|
||||
// This removes the 'refs/tags' portion of the string, i.e. from 'refs/tags/v1.10.15' to 'v1.10.15'
|
||||
const tag = tagName.replace('refs/tags/', '');
|
||||
const releaseName = core.getInput('release_name', { required: true }).replace('refs/tags/', '');
|
||||
const body = core.getInput('body', { required: false });
|
||||
const draft = core.getInput('draft', { required: false }) === 'true';
|
||||
const prerelease = core.getInput('prerelease', { required: false }) === 'true';
|
||||
|
||||
@@ -26,6 +27,7 @@ async function run() {
|
||||
repo,
|
||||
tag_name: tag,
|
||||
name: releaseName,
|
||||
body,
|
||||
draft,
|
||||
prerelease
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user