mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 02:44:20 +00:00
Add 'fail_on_unmatched_files' input (#55)
This commit is contained in:
parent
9439581056
commit
4fb86a77e0
6 changed files with 54 additions and 17 deletions
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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue