mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-10-09 08:56:12 +00:00
fix: gracefully fallback to body when body_path cannot be read
Co-authored-by: chenrui333 <1580956+chenrui333@users.noreply.github.com>
This commit is contained in:
parent
9dc3c0d41d
commit
84004cd30e
2 changed files with 57 additions and 4 deletions
|
@ -110,6 +110,52 @@ describe('util', () => {
|
|||
}),
|
||||
);
|
||||
});
|
||||
it('falls back to body when body_path is missing', () => {
|
||||
assert.equal(
|
||||
releaseBody({
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_body: 'fallback-body',
|
||||
input_body_path: '__tests__/does-not-exist.txt',
|
||||
input_draft: false,
|
||||
input_prerelease: false,
|
||||
input_files: [],
|
||||
input_overwrite_files: undefined,
|
||||
input_preserve_order: undefined,
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}),
|
||||
'fallback-body',
|
||||
);
|
||||
});
|
||||
it('returns undefined when body_path is missing and body is not provided', () => {
|
||||
assert.equal(
|
||||
releaseBody({
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_body: undefined,
|
||||
input_body_path: '__tests__/does-not-exist.txt',
|
||||
input_draft: false,
|
||||
input_prerelease: false,
|
||||
input_files: [],
|
||||
input_overwrite_files: undefined,
|
||||
input_preserve_order: undefined,
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}),
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('parseConfig', () => {
|
||||
it('parses basic config', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue