Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make pattern error opt in #417

Merged
merged 2 commits into from Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,7 @@
## 2.0.2 (unreleased)

- Revisit approach to [#384](https://github.com/softprops/action-gh-release/pull/384) making unresolved pattern failures opt-in [#417](https://github.com/softprops/action-gh-release/pull/417)

## 2.0.1

- Add support for make_latest property [#304](https://github.com/softprops/action-gh-release/pull/304) via [@samueljseay](https://github.com/samueljseay)
Expand Down
6 changes: 5 additions & 1 deletion src/main.ts
Expand Up @@ -25,7 +25,11 @@ async function run() {
if (config.input_files) {
const patterns = unmatchedPatterns(config.input_files);
patterns.forEach((pattern) => {
throw new Error(`⚠️ Pattern '${pattern}' does not match any files.`);
if (config.input_fail_on_unmatched_files) {
throw new Error(`⚠️ Pattern '${pattern}' does not match any files.`);
} else {
console.warn(`🤔 Pattern '${pattern}' does not match any files.`);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When false (the default) and no files are matched, the action still fails on

throw new Error(`⚠️ ${config.input_files} not include valid file.`);

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following up on this in #425

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should now be fixed in the latest v2 tag

});
if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
throw new Error(`⚠️ There were unmatched files`);
Expand Down