Add 'fail_on_unmatched_files' input (#55)
This commit is contained in:
11
src/main.ts
11
src/main.ts
@ -1,4 +1,4 @@
|
||||
import { paths, parseConfig, isTag } from "./util";
|
||||
import { paths, parseConfig, isTag, unmatchedPatterns } from "./util";
|
||||
import { release, upload, GitHubReleaser } from "./github";
|
||||
import { setFailed, setOutput } from "@actions/core";
|
||||
import { GitHub } from "@actions/github";
|
||||
@ -10,6 +10,15 @@ async function run() {
|
||||
if (!config.input_tag_name && !isTag(config.github_ref)) {
|
||||
throw new Error(`⚠️ GitHub Releases requires a tag`);
|
||||
}
|
||||
if (config.input_files) {
|
||||
const patterns = unmatchedPatterns(config.input_files);
|
||||
patterns.forEach(pattern =>
|
||||
console.warn(`🤔 Pattern '${pattern}' does not match any files.`)
|
||||
);
|
||||
if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
|
||||
throw new Error(`⚠️ There were unmatched files`);
|
||||
}
|
||||
}
|
||||
GitHub.plugin([
|
||||
require("@octokit/plugin-throttling"),
|
||||
require("@octokit/plugin-retry")
|
||||
|
Reference in New Issue
Block a user