Skip to content

Commit

Permalink
Defer dry run bail out in asset globbing (to include the warning in d…
Browse files Browse the repository at this point in the history
…ry runs)
  • Loading branch information
webpro committed Sep 15, 2022
1 parent feff2eb commit bf6ccc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/plugin/github/GitHub.js
Expand Up @@ -286,14 +286,17 @@ class GitHub extends Release {

this.log.exec('octokit repos.uploadReleaseAssets', patterns, { isDryRun });

if (!assets || !isReleased || isDryRun) {
if (!assets || !isReleased) {
return true;
}

return globby(patterns).then(files => {
if (!files.length) {
this.log.warn(`octokit repos.uploadReleaseAssets: did not find "${assets}" relative to ${process.cwd()}`);
}

if (isDryRun) return Promise.resolve();

return Promise.all(files.map(filePath => this.uploadAsset(filePath)));
});
}
Expand Down
5 changes: 4 additions & 1 deletion lib/plugin/gitlab/GitLab.js
Expand Up @@ -257,14 +257,17 @@ class GitLab extends Release {

this.log.exec('gitlab releases#uploadAssets', patterns, { isDryRun });

if (!assets || isDryRun) {
if (!assets) {
return noop;
}

return globby(patterns).then(files => {
if (!files.length) {
this.log.warn(`gitlab releases#uploadAssets: could not find "${assets}" relative to ${process.cwd()}`);
}

if (isDryRun) return Promise.resolve();

return Promise.all(files.map(filePath => this.uploadAsset(filePath)));
});
}
Expand Down

0 comments on commit bf6ccc8

Please sign in to comment.