mirror of
https://github.com/actions/create-release.git
synced 2025-07-30 06:37:41 +00:00
only error on actual attempt at using bodyFromFile and reorder a bit for tests
This commit is contained in:
parent
76860a04af
commit
c06331b12c
19
dist/index.js
vendored
19
dist/index.js
vendored
@ -7863,16 +7863,19 @@ async function run() {
|
||||
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 bodyFromFile = core.getInput('bodyFromFile', { required: false });
|
||||
let bodyFile = null;
|
||||
try {
|
||||
bodyFile = fs.readFileSync(bodyFromFile, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
const draft = core.getInput('draft', { required: false }) === 'true';
|
||||
const prerelease = core.getInput('prerelease', { required: false }) === 'true';
|
||||
|
||||
const bodyFromFile = core.getInput('bodyFromFile', { required: false });
|
||||
let bodyFileContent = null;
|
||||
if (bodyFromFile !== '' && !!bodyFromFile) {
|
||||
try {
|
||||
bodyFileContent = fs.readFileSync(bodyFromFile, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a release
|
||||
// API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release
|
||||
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release
|
||||
@ -7881,7 +7884,7 @@ async function run() {
|
||||
repo,
|
||||
tag_name: tag,
|
||||
name: releaseName,
|
||||
body: bodyFile || body,
|
||||
body: bodyFileContent || body,
|
||||
draft,
|
||||
prerelease
|
||||
});
|
||||
|
@ -17,16 +17,19 @@ async function run() {
|
||||
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 bodyFromFile = core.getInput('bodyFromFile', { required: false });
|
||||
let bodyFile = null;
|
||||
try {
|
||||
bodyFile = fs.readFileSync(bodyFromFile, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
const draft = core.getInput('draft', { required: false }) === 'true';
|
||||
const prerelease = core.getInput('prerelease', { required: false }) === 'true';
|
||||
|
||||
const bodyFromFile = core.getInput('bodyFromFile', { required: false });
|
||||
let bodyFileContent = null;
|
||||
if (bodyFromFile !== '' && !!bodyFromFile) {
|
||||
try {
|
||||
bodyFileContent = fs.readFileSync(bodyFromFile, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a release
|
||||
// API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release
|
||||
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release
|
||||
@ -35,7 +38,7 @@ async function run() {
|
||||
repo,
|
||||
tag_name: tag,
|
||||
name: releaseName,
|
||||
body: bodyFile || body,
|
||||
body: bodyFileContent || body,
|
||||
draft,
|
||||
prerelease
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user