mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-27 22:06:03 +00:00
update test and run fmt/build
Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
parent
edc85f0b7e
commit
18f874a13d
4 changed files with 41 additions and 30 deletions
|
@ -16,9 +16,9 @@ describe("util", () => {
|
|||
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",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ describe("util", () => {
|
|||
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"]
|
||||
["foo", "bar", "baz", "boom", "doom", "loom"],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -57,7 +57,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
it("uses input body path", () => {
|
||||
|
@ -80,7 +80,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
it("defaults to body path when both body and body path are provided", () => {
|
||||
|
@ -103,7 +103,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -139,7 +139,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -167,7 +167,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
it("supports discussion category names", () => {
|
||||
|
@ -187,13 +187,14 @@ describe("util", () => {
|
|||
input_files: [],
|
||||
input_preserve_order: undefined,
|
||||
input_name: undefined,
|
||||
input_overwrite_files: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: "releases",
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -221,7 +222,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: true,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -253,7 +254,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
it("uses input token as the source of GITHUB_TOKEN by default", () => {
|
||||
|
@ -282,7 +283,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
it("parses basic config with draft and prerelease", () => {
|
||||
|
@ -310,7 +311,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
it("parses basic config where make_latest is passed", () => {
|
||||
|
@ -330,13 +331,14 @@ describe("util", () => {
|
|||
input_preserve_order: undefined,
|
||||
input_files: [],
|
||||
input_name: undefined,
|
||||
input_overwrite_files: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: "false",
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
it("parses basic config with append_body", () => {
|
||||
|
@ -363,7 +365,7 @@ describe("util", () => {
|
|||
input_discussion_category_name: undefined,
|
||||
input_generate_release_notes: false,
|
||||
input_make_latest: undefined,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -380,7 +382,7 @@ describe("util", () => {
|
|||
it("resolves files given a set of paths", async () => {
|
||||
assert.deepStrictEqual(
|
||||
paths(["tests/data/**/*", "tests/data/does/not/exist/*"]),
|
||||
["tests/data/foo/bar.txt"]
|
||||
["tests/data/foo/bar.txt"],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -389,7 +391,7 @@ describe("util", () => {
|
|||
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/*"]
|
||||
["tests/data/does/not/exist/*"],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -401,7 +403,7 @@ describe("util", () => {
|
|||
|
||||
it("handles names with multiple spaces", () => {
|
||||
expect(alignAssetName("John William Doe.bla")).toBe(
|
||||
"John.William.Doe.bla"
|
||||
"John.William.Doe.bla",
|
||||
);
|
||||
});
|
||||
|
||||
|
|
21
dist/index.js
vendored
21
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -170,7 +170,7 @@ export const upload = async (
|
|||
if (currentAsset) {
|
||||
if (config.input_overwrite_files === false) {
|
||||
console.log(
|
||||
`Asset ${name} already exists and overwrite_files is false...`
|
||||
`Asset ${name} already exists and overwrite_files is false...`,
|
||||
);
|
||||
return null;
|
||||
} else {
|
||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -45,7 +45,7 @@ async function run() {
|
|||
throttle: {
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
console.warn(
|
||||
`Request quota exhausted for request ${options.method} ${options.url}`
|
||||
`Request quota exhausted for request ${options.method} ${options.url}`,
|
||||
);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
|
@ -56,7 +56,7 @@ async function run() {
|
|||
onAbuseLimit: (retryAfter, options) => {
|
||||
// does not retry, only logs a warning
|
||||
console.warn(
|
||||
`Abuse detected for request ${options.method} ${options.url}`
|
||||
`Abuse detected for request ${options.method} ${options.url}`,
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -68,11 +68,11 @@ async function run() {
|
|||
if (files.length == 0) {
|
||||
if (config.input_fail_on_unmatched_files) {
|
||||
throw new Error(
|
||||
`⚠️ ${config.input_files} does not include a valid file.`
|
||||
`⚠️ ${config.input_files} does not include a valid file.`,
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
`🤔 ${config.input_files} does not include a valid file.`
|
||||
`🤔 ${config.input_files} does not include a valid file.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ async function run() {
|
|||
gh,
|
||||
uploadUrl(rel.upload_url),
|
||||
path,
|
||||
currentAssets
|
||||
currentAssets,
|
||||
);
|
||||
if (json) {
|
||||
delete json.uploader;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue