mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-10 18:44:19 +00:00
Fix: skip uploading empty assets
This commit is contained in:
parent
c9b46fe7aa
commit
e86d563ce8
1 changed files with 5 additions and 0 deletions
|
@ -148,6 +148,7 @@ export const upload = async (
|
|||
const currentAsset = currentAssets.find(
|
||||
({ name: currentName }) => currentName == name
|
||||
);
|
||||
// Delete old asset even if the size of currentAsset is 0
|
||||
if (currentAsset) {
|
||||
console.log(`♻️ Deleting previously uploaded asset ${name}...`);
|
||||
await github.rest.repos.deleteReleaseAsset({
|
||||
|
@ -156,6 +157,10 @@ export const upload = async (
|
|||
repo,
|
||||
});
|
||||
}
|
||||
if (size === 0) {
|
||||
console.warn(`❌ Skip uploading release asset ${name} with 0 byte in size`);
|
||||
return {}; // return empty JSON object for compatibility
|
||||
}
|
||||
console.log(`⬆️ Uploading ${name}...`);
|
||||
const endpoint = new URL(url);
|
||||
endpoint.searchParams.append("name", name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue