mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 14:16:02 +00:00
Merge branch 'master' of https://github.com/softprops/action-gh-release into feat/add-generateReleaseNotes
Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
commit
4577bf1fa8
8 changed files with 285 additions and 391 deletions
|
@ -1,62 +1,56 @@
|
|||
import {
|
||||
asset,
|
||||
findTagFromReleases,
|
||||
mimeOrDefault,
|
||||
Release,
|
||||
Releaser,
|
||||
} from "../src/github";
|
||||
import { asset, findTagFromReleases, mimeOrDefault, Release, Releaser } from '../src/github';
|
||||
|
||||
import { assert, describe, it } from "vitest";
|
||||
import { assert, describe, it } from 'vitest';
|
||||
|
||||
describe("github", () => {
|
||||
describe("mimeOrDefault", () => {
|
||||
it("returns a specific mime for common path", async () => {
|
||||
assert.equal(mimeOrDefault("foo.tar.gz"), "application/gzip");
|
||||
describe('github', () => {
|
||||
describe('mimeOrDefault', () => {
|
||||
it('returns a specific mime for common path', async () => {
|
||||
assert.equal(mimeOrDefault('foo.tar.gz'), 'application/gzip');
|
||||
});
|
||||
it("returns default mime for uncommon path", async () => {
|
||||
assert.equal(mimeOrDefault("foo.uncommon"), "application/octet-stream");
|
||||
it('returns default mime for uncommon path', async () => {
|
||||
assert.equal(mimeOrDefault('foo.uncommon'), 'application/octet-stream');
|
||||
});
|
||||
});
|
||||
|
||||
describe("asset", () => {
|
||||
it("derives asset info from a path", async () => {
|
||||
const { name, mime, size } = asset("tests/data/foo/bar.txt");
|
||||
assert.equal(name, "bar.txt");
|
||||
assert.equal(mime, "text/plain");
|
||||
describe('asset', () => {
|
||||
it('derives asset info from a path', async () => {
|
||||
const { name, mime, size } = asset('tests/data/foo/bar.txt');
|
||||
assert.equal(name, 'bar.txt');
|
||||
assert.equal(mime, 'text/plain');
|
||||
assert.equal(size, 10);
|
||||
});
|
||||
});
|
||||
|
||||
describe("findTagFromReleases", () => {
|
||||
const owner = "owner";
|
||||
const repo = "repo";
|
||||
describe('findTagFromReleases', () => {
|
||||
const owner = 'owner';
|
||||
const repo = 'repo';
|
||||
|
||||
const mockRelease: Release = {
|
||||
id: 1,
|
||||
upload_url: `https://api.github.com/repos/${owner}/${repo}/releases/1/assets`,
|
||||
html_url: `https://github.com/${owner}/${repo}/releases/tag/v1.0.0`,
|
||||
tag_name: "v1.0.0",
|
||||
name: "Test Release",
|
||||
body: "Test body",
|
||||
target_commitish: "main",
|
||||
tag_name: 'v1.0.0',
|
||||
name: 'Test Release',
|
||||
body: 'Test body',
|
||||
target_commitish: 'main',
|
||||
draft: false,
|
||||
prerelease: false,
|
||||
assets: [],
|
||||
} as const;
|
||||
|
||||
const mockReleaser: Releaser = {
|
||||
getReleaseByTag: () => Promise.reject("Not implemented"),
|
||||
createRelease: () => Promise.reject("Not implemented"),
|
||||
updateRelease: () => Promise.reject("Not implemented"),
|
||||
getReleaseByTag: () => Promise.reject('Not implemented'),
|
||||
createRelease: () => Promise.reject('Not implemented'),
|
||||
updateRelease: () => Promise.reject('Not implemented'),
|
||||
allReleases: async function* () {
|
||||
yield { data: [mockRelease] };
|
||||
},
|
||||
} as const;
|
||||
|
||||
describe("when the tag_name is not an empty string", () => {
|
||||
const targetTag = "v1.0.0";
|
||||
describe('when the tag_name is not an empty string', () => {
|
||||
const targetTag = 'v1.0.0';
|
||||
|
||||
it("finds a matching release in first batch of results", async () => {
|
||||
it('finds a matching release in first batch of results', async () => {
|
||||
const targetRelease = {
|
||||
...mockRelease,
|
||||
owner,
|
||||
|
@ -67,7 +61,7 @@ describe("github", () => {
|
|||
...mockRelease,
|
||||
owner,
|
||||
repo,
|
||||
tag_name: "v1.0.1",
|
||||
tag_name: 'v1.0.1',
|
||||
};
|
||||
|
||||
const releaser = {
|
||||
|
@ -78,17 +72,12 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
targetTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, targetTag);
|
||||
|
||||
assert.deepStrictEqual(result, targetRelease);
|
||||
});
|
||||
|
||||
it("finds a matching release in second batch of results", async () => {
|
||||
it('finds a matching release in second batch of results', async () => {
|
||||
const targetRelease = {
|
||||
...mockRelease,
|
||||
owner,
|
||||
|
@ -99,7 +88,7 @@ describe("github", () => {
|
|||
...mockRelease,
|
||||
owner,
|
||||
repo,
|
||||
tag_name: "v1.0.1",
|
||||
tag_name: 'v1.0.1',
|
||||
};
|
||||
|
||||
const releaser = {
|
||||
|
@ -110,21 +99,16 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
targetTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, targetTag);
|
||||
assert.deepStrictEqual(result, targetRelease);
|
||||
});
|
||||
|
||||
it("returns undefined when a release is not found in any batch", async () => {
|
||||
it('returns undefined when a release is not found in any batch', async () => {
|
||||
const otherRelease = {
|
||||
...mockRelease,
|
||||
owner,
|
||||
repo,
|
||||
tag_name: "v1.0.1",
|
||||
tag_name: 'v1.0.1',
|
||||
};
|
||||
const releaser = {
|
||||
...mockReleaser,
|
||||
|
@ -134,17 +118,12 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
targetTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, targetTag);
|
||||
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
|
||||
it("returns undefined when no releases are returned", async () => {
|
||||
it('returns undefined when no releases are returned', async () => {
|
||||
const releaser = {
|
||||
...mockReleaser,
|
||||
allReleases: async function* () {
|
||||
|
@ -152,21 +131,16 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
targetTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, targetTag);
|
||||
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when the tag_name is an empty string", () => {
|
||||
const emptyTag = "";
|
||||
describe('when the tag_name is an empty string', () => {
|
||||
const emptyTag = '';
|
||||
|
||||
it("finds a matching release in first batch of results", async () => {
|
||||
it('finds a matching release in first batch of results', async () => {
|
||||
const targetRelease = {
|
||||
...mockRelease,
|
||||
owner,
|
||||
|
@ -177,7 +151,7 @@ describe("github", () => {
|
|||
...mockRelease,
|
||||
owner,
|
||||
repo,
|
||||
tag_name: "v1.0.1",
|
||||
tag_name: 'v1.0.1',
|
||||
};
|
||||
|
||||
const releaser = {
|
||||
|
@ -188,17 +162,12 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
emptyTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, emptyTag);
|
||||
|
||||
assert.deepStrictEqual(result, targetRelease);
|
||||
});
|
||||
|
||||
it("finds a matching release in second batch of results", async () => {
|
||||
it('finds a matching release in second batch of results', async () => {
|
||||
const targetRelease = {
|
||||
...mockRelease,
|
||||
owner,
|
||||
|
@ -209,7 +178,7 @@ describe("github", () => {
|
|||
...mockRelease,
|
||||
owner,
|
||||
repo,
|
||||
tag_name: "v1.0.1",
|
||||
tag_name: 'v1.0.1',
|
||||
};
|
||||
|
||||
const releaser = {
|
||||
|
@ -220,21 +189,16 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
emptyTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, emptyTag);
|
||||
assert.deepStrictEqual(result, targetRelease);
|
||||
});
|
||||
|
||||
it("returns undefined when a release is not found in any batch", async () => {
|
||||
it('returns undefined when a release is not found in any batch', async () => {
|
||||
const otherRelease = {
|
||||
...mockRelease,
|
||||
owner,
|
||||
repo,
|
||||
tag_name: "v1.0.1",
|
||||
tag_name: 'v1.0.1',
|
||||
};
|
||||
const releaser = {
|
||||
...mockReleaser,
|
||||
|
@ -244,17 +208,12 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
emptyTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, emptyTag);
|
||||
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
|
||||
it("returns undefined when no releases are returned", async () => {
|
||||
it('returns undefined when no releases are returned', async () => {
|
||||
const releaser = {
|
||||
...mockReleaser,
|
||||
allReleases: async function* () {
|
||||
|
@ -262,12 +221,7 @@ describe("github", () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = await findTagFromReleases(
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
emptyTag,
|
||||
);
|
||||
const result = await findTagFromReleases(releaser, owner, repo, emptyTag);
|
||||
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
|
|
|
@ -7,44 +7,48 @@ import {
|
|||
releaseBody,
|
||||
unmatchedPatterns,
|
||||
uploadUrl,
|
||||
} from "../src/util";
|
||||
} from '../src/util';
|
||||
|
||||
import { assert, describe, expect, it } from "vitest";
|
||||
import { assert, describe, expect, it } from 'vitest';
|
||||
|
||||
describe("util", () => {
|
||||
describe("uploadUrl", () => {
|
||||
it("strips template", () => {
|
||||
describe('util', () => {
|
||||
describe('uploadUrl', () => {
|
||||
it('strips template', () => {
|
||||
assert.equal(
|
||||
uploadUrl(
|
||||
"https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
|
||||
'https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}',
|
||||
),
|
||||
"https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets",
|
||||
'https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets',
|
||||
);
|
||||
});
|
||||
});
|
||||
describe("parseInputFiles", () => {
|
||||
it("parses empty strings", () => {
|
||||
assert.deepStrictEqual(parseInputFiles(""), []);
|
||||
describe('parseInputFiles', () => {
|
||||
it('parses empty strings', () => {
|
||||
assert.deepStrictEqual(parseInputFiles(''), []);
|
||||
});
|
||||
it("parses comma-delimited strings", () => {
|
||||
assert.deepStrictEqual(parseInputFiles("foo,bar"), ["foo", "bar"]);
|
||||
it('parses comma-delimited strings', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('foo,bar'), ['foo', 'bar']);
|
||||
});
|
||||
it("parses newline and comma-delimited (and then some)", () => {
|
||||
assert.deepStrictEqual(
|
||||
parseInputFiles("foo,bar\nbaz,boom,\n\ndoom,loom "),
|
||||
["foo", "bar", "baz", "boom", "doom", "loom"],
|
||||
);
|
||||
it('parses newline and comma-delimited (and then some)', () => {
|
||||
assert.deepStrictEqual(parseInputFiles('foo,bar\nbaz,boom,\n\ndoom,loom '), [
|
||||
'foo',
|
||||
'bar',
|
||||
'baz',
|
||||
'boom',
|
||||
'doom',
|
||||
'loom',
|
||||
]);
|
||||
});
|
||||
});
|
||||
describe("releaseBody", () => {
|
||||
it("uses input body", () => {
|
||||
describe('releaseBody', () => {
|
||||
it('uses input body', () => {
|
||||
assert.equal(
|
||||
"foo",
|
||||
'foo',
|
||||
releaseBody({
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
input_body: "foo",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_body: 'foo',
|
||||
input_body_path: undefined,
|
||||
input_draft: false,
|
||||
input_prerelease: false,
|
||||
|
@ -61,15 +65,15 @@ describe("util", () => {
|
|||
}),
|
||||
);
|
||||
});
|
||||
it("uses input body path", () => {
|
||||
it('uses input body path', () => {
|
||||
assert.equal(
|
||||
"bar",
|
||||
'bar',
|
||||
releaseBody({
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_body: undefined,
|
||||
input_body_path: "__tests__/release.txt",
|
||||
input_body_path: '__tests__/release.txt',
|
||||
input_draft: false,
|
||||
input_prerelease: false,
|
||||
input_preserve_order: undefined,
|
||||
|
@ -85,15 +89,15 @@ describe("util", () => {
|
|||
}),
|
||||
);
|
||||
});
|
||||
it("defaults to body path when both body and body path are provided", () => {
|
||||
it('defaults to body path when both body and body path are provided', () => {
|
||||
assert.equal(
|
||||
"bar",
|
||||
'bar',
|
||||
releaseBody({
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
input_body: "foo",
|
||||
input_body_path: "__tests__/release.txt",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_body: 'foo',
|
||||
input_body_path: '__tests__/release.txt',
|
||||
input_draft: false,
|
||||
input_prerelease: false,
|
||||
input_preserve_order: undefined,
|
||||
|
@ -110,8 +114,8 @@ describe("util", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
describe("parseConfig", () => {
|
||||
it("parses basic config", () => {
|
||||
describe('parseConfig', () => {
|
||||
it('parses basic config', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
// note: inputs declared in actions.yml, even when declared not required,
|
||||
|
@ -120,13 +124,13 @@ describe("util", () => {
|
|||
// as an empty string !== undefined in terms of what we pass to the api
|
||||
// so we cover that in a test case here to ensure undefined values are actually
|
||||
// resolved as undefined and not empty strings
|
||||
INPUT_TARGET_COMMITISH: "",
|
||||
INPUT_DISCUSSION_CATEGORY_NAME: "",
|
||||
INPUT_TARGET_COMMITISH: '',
|
||||
INPUT_DISCUSSION_CATEGORY_NAME: '',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -147,15 +151,15 @@ describe("util", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("parses basic config with commitish", () => {
|
||||
it('parses basic config with commitish', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_TARGET_COMMITISH: "affa18ef97bc9db20076945705aba8c516139abd",
|
||||
INPUT_TARGET_COMMITISH: 'affa18ef97bc9db20076945705aba8c516139abd',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -167,7 +171,7 @@ describe("util", () => {
|
|||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd",
|
||||
input_target_commitish: 'affa18ef97bc9db20076945705aba8c516139abd',
|
||||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
|
@ -175,15 +179,15 @@ describe("util", () => {
|
|||
},
|
||||
);
|
||||
});
|
||||
it("supports discussion category names", () => {
|
||||
it('supports discussion category names', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_DISCUSSION_CATEGORY_NAME: "releases",
|
||||
INPUT_DISCUSSION_CATEGORY_NAME: 'releases',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -196,7 +200,7 @@ describe("util", () => {
|
|||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: "releases",
|
||||
input_discussion_category_name: 'releases',
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
input_previous_tag: undefined,
|
||||
|
@ -204,15 +208,15 @@ describe("util", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("supports generating release notes", () => {
|
||||
it('supports generating release notes', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_GENERATE_RELEASE_NOTES: "true",
|
||||
INPUT_GENERATE_RELEASE_NOTES: 'true',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -233,19 +237,19 @@ describe("util", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("prefers GITHUB_TOKEN over token input for backwards compatibility", () => {
|
||||
it('prefers GITHUB_TOKEN over token input for backwards compatibility', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_DRAFT: "false",
|
||||
INPUT_PRERELEASE: "true",
|
||||
INPUT_PRESERVE_ORDER: "true",
|
||||
GITHUB_TOKEN: "env-token",
|
||||
INPUT_TOKEN: "input-token",
|
||||
INPUT_DRAFT: 'false',
|
||||
INPUT_PRERELEASE: 'true',
|
||||
INPUT_PRESERVE_ORDER: 'true',
|
||||
GITHUB_TOKEN: 'env-token',
|
||||
INPUT_TOKEN: 'input-token',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "env-token",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: 'env-token',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -265,17 +269,17 @@ describe("util", () => {
|
|||
},
|
||||
);
|
||||
});
|
||||
it("uses input token as the source of GITHUB_TOKEN by default", () => {
|
||||
it('uses input token as the source of GITHUB_TOKEN by default', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_DRAFT: "false",
|
||||
INPUT_PRERELEASE: "true",
|
||||
INPUT_TOKEN: "input-token",
|
||||
INPUT_DRAFT: 'false',
|
||||
INPUT_PRERELEASE: 'true',
|
||||
INPUT_TOKEN: 'input-token',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "input-token",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: 'input-token',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -295,16 +299,16 @@ describe("util", () => {
|
|||
},
|
||||
);
|
||||
});
|
||||
it("parses basic config with draft and prerelease", () => {
|
||||
it('parses basic config with draft and prerelease', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_DRAFT: "false",
|
||||
INPUT_PRERELEASE: "true",
|
||||
INPUT_DRAFT: 'false',
|
||||
INPUT_PRERELEASE: 'true',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -324,15 +328,15 @@ describe("util", () => {
|
|||
},
|
||||
);
|
||||
});
|
||||
it("parses basic config where make_latest is passed", () => {
|
||||
it('parses basic config where make_latest is passed', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_MAKE_LATEST: "false",
|
||||
INPUT_MAKE_LATEST: 'false',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: false,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -347,20 +351,20 @@ describe("util", () => {
|
|||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: "false",
|
||||
input_make_latest: 'false',
|
||||
input_previous_tag: undefined,
|
||||
},
|
||||
);
|
||||
});
|
||||
it("parses basic config with append_body", () => {
|
||||
it('parses basic config with append_body', () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_APPEND_BODY: "true",
|
||||
INPUT_APPEND_BODY: 'true',
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
github_ref: '',
|
||||
github_repository: '',
|
||||
github_token: '',
|
||||
input_append_body: true,
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
|
@ -381,46 +385,43 @@ describe("util", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
describe("isTag", () => {
|
||||
it("returns true for tags", async () => {
|
||||
assert.equal(isTag("refs/tags/foo"), true);
|
||||
describe('isTag', () => {
|
||||
it('returns true for tags', async () => {
|
||||
assert.equal(isTag('refs/tags/foo'), true);
|
||||
});
|
||||
it("returns false for other kinds of refs", async () => {
|
||||
assert.equal(isTag("refs/heads/master"), false);
|
||||
it('returns false for other kinds of refs', async () => {
|
||||
assert.equal(isTag('refs/heads/master'), false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("paths", () => {
|
||||
it("resolves files given a set of paths", async () => {
|
||||
assert.deepStrictEqual(
|
||||
paths(["tests/data/**/*", "tests/data/does/not/exist/*"]),
|
||||
["tests/data/foo/bar.txt"],
|
||||
);
|
||||
describe('paths', () => {
|
||||
it('resolves files given a set of paths', async () => {
|
||||
assert.deepStrictEqual(paths(['tests/data/**/*', 'tests/data/does/not/exist/*']), [
|
||||
'tests/data/foo/bar.txt',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("unmatchedPatterns", () => {
|
||||
describe('unmatchedPatterns', () => {
|
||||
it("returns the patterns that don't match any files", async () => {
|
||||
assert.deepStrictEqual(
|
||||
unmatchedPatterns(["tests/data/**/*", "tests/data/does/not/exist/*"]),
|
||||
["tests/data/does/not/exist/*"],
|
||||
unmatchedPatterns(['tests/data/**/*', 'tests/data/does/not/exist/*']),
|
||||
['tests/data/does/not/exist/*'],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("replaceSpacesWithDots", () => {
|
||||
it("replaces all spaces with dots", () => {
|
||||
expect(alignAssetName("John Doe.bla")).toBe("John.Doe.bla");
|
||||
describe('replaceSpacesWithDots', () => {
|
||||
it('replaces all spaces with dots', () => {
|
||||
expect(alignAssetName('John Doe.bla')).toBe('John.Doe.bla');
|
||||
});
|
||||
|
||||
it("handles names with multiple spaces", () => {
|
||||
expect(alignAssetName("John William Doe.bla")).toBe(
|
||||
"John.William.Doe.bla",
|
||||
);
|
||||
it('handles names with multiple spaces', () => {
|
||||
expect(alignAssetName('John William Doe.bla')).toBe('John.William.Doe.bla');
|
||||
});
|
||||
|
||||
it("returns the same string if there are no spaces", () => {
|
||||
expect(alignAssetName("JohnDoe")).toBe("JohnDoe");
|
||||
it('returns the same string if there are no spaces', () => {
|
||||
expect(alignAssetName('JohnDoe')).toBe('JohnDoe');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue