mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-11-23 11:50:51 +00:00
Merge remote-tracking branch 'upstream/master' into feat/previus_tag
This commit is contained in:
commit
84a2a597c6
12 changed files with 980 additions and 913 deletions
|
|
@ -39,6 +39,18 @@ describe('util', () => {
|
|||
'loom',
|
||||
]);
|
||||
});
|
||||
it('handles globs with brace groups containing commas', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('./**/*.{exe,deb,tar.gz}\nfoo,bar'), [
|
||||
'./**/*.{exe,deb,tar.gz}',
|
||||
'foo',
|
||||
'bar',
|
||||
]);
|
||||
});
|
||||
it('handles single-line brace pattern correctly', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('./**/*.{exe,deb,tar.gz}'), [
|
||||
'./**/*.{exe,deb,tar.gz}',
|
||||
]);
|
||||
});
|
||||
});
|
||||
describe('releaseBody', () => {
|
||||
it('uses input body', () => {
|
||||
|
|
@ -113,6 +125,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', () => {
|
||||
|
|
@ -131,6 +189,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -160,6 +219,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -188,6 +248,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -217,6 +278,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -250,6 +312,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: 'env-token',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -280,6 +343,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: 'input-token',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -309,6 +373,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -337,6 +402,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -365,6 +431,7 @@ describe('util', () => {
|
|||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_working_directory: undefined,
|
||||
input_append_body: true,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
|
@ -400,6 +467,10 @@ describe('util', () => {
|
|||
'tests/data/foo/bar.txt',
|
||||
]);
|
||||
});
|
||||
|
||||
it('resolves files relative to working_directory', async () => {
|
||||
assert.deepStrictEqual(paths(['data/**/*'], 'tests'), ['tests/data/foo/bar.txt']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('unmatchedPatterns', () => {
|
||||
|
|
@ -409,6 +480,12 @@ describe('util', () => {
|
|||
['tests/data/does/not/exist/*'],
|
||||
);
|
||||
});
|
||||
|
||||
it('resolves unmatched relative to working_directory', async () => {
|
||||
assert.deepStrictEqual(unmatchedPatterns(['data/does/not/exist/*'], 'tests'), [
|
||||
'data/does/not/exist/*',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('replaceSpacesWithDots', () => {
|
||||
|
|
@ -425,3 +502,36 @@ describe('util', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseInputFiles edge cases', () => {
|
||||
it('handles multiple brace groups on same line', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('./**/*.{exe,deb},./dist/**/*.{zip,tar.gz}'), [
|
||||
'./**/*.{exe,deb}',
|
||||
'./dist/**/*.{zip,tar.gz}',
|
||||
]);
|
||||
});
|
||||
|
||||
it('handles nested braces', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('path/{a,{b,c}}/file.txt'), ['path/{a,{b,c}}/file.txt']);
|
||||
});
|
||||
|
||||
it('handles empty comma-separated values', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('foo,,bar'), ['foo', 'bar']);
|
||||
});
|
||||
|
||||
it('handles commas with spaces around braces', () => {
|
||||
assert.deepStrictEqual(parseInputFiles(' ./**/*.{exe,deb} , file.txt '), [
|
||||
'./**/*.{exe,deb}',
|
||||
'file.txt',
|
||||
]);
|
||||
});
|
||||
|
||||
it('handles mixed newlines and commas with braces', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('file1.txt\n./**/*.{exe,deb},file2.txt\nfile3.txt'), [
|
||||
'file1.txt',
|
||||
'./**/*.{exe,deb}',
|
||||
'file2.txt',
|
||||
'file3.txt',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue