Skip to content

Commit

Permalink
fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Nov 10, 2021
1 parent 1bbefce commit e71aed1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/upload-release-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,13 @@ async function validateFilenames(files: string[], opts: Options): Promise<void>
files: [],
};
}

// check duplications
const duplications: AssetOrFile[] = [];
for (const file of files) {
const name = canonicalName(opts.assetName || path.basename(file));
const asset = assets[name];
if (asset) {
if (name in assets) {
const asset = assets[name];
duplications.push(asset);
asset.files.push(file);
} else {
Expand All @@ -227,13 +228,12 @@ async function validateFilenames(files: string[], opts: Options): Promise<void>
// report the result of validation
let errorCount = 0;
for (const item of duplications) {
if (item.files.length <= 1) {
return;
if (item.files.length > 1) {
core.error(
`validation error: file name "${item.name}" is duplicated. (${item.files.join(", ")})`
);
errorCount++;
}
core.error(
`validation error: file name "${item.name}" is duplicated. (${item.files.join(", ")})`
);
errorCount++;
}

// report the result of validation
Expand Down

0 comments on commit e71aed1

Please sign in to comment.