mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 19:04:20 +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(
|
const currentAsset = currentAssets.find(
|
||||||
({ name: currentName }) => currentName == name
|
({ name: currentName }) => currentName == name
|
||||||
);
|
);
|
||||||
|
// Delete old asset even if the size of currentAsset is 0
|
||||||
if (currentAsset) {
|
if (currentAsset) {
|
||||||
console.log(`♻️ Deleting previously uploaded asset ${name}...`);
|
console.log(`♻️ Deleting previously uploaded asset ${name}...`);
|
||||||
await github.rest.repos.deleteReleaseAsset({
|
await github.rest.repos.deleteReleaseAsset({
|
||||||
|
@ -156,6 +157,10 @@ export const upload = async (
|
||||||
repo,
|
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}...`);
|
console.log(`⬆️ Uploading ${name}...`);
|
||||||
const endpoint = new URL(url);
|
const endpoint = new URL(url);
|
||||||
endpoint.searchParams.append("name", name);
|
endpoint.searchParams.append("name", name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue