Add input option overwrite_files.

This commit is contained in:
Adriano dos Santos Fernandes 2023-03-30 22:08:17 -03:00
parent c9b46fe7aa
commit 40ca4763d5
7 changed files with 52 additions and 19 deletions

View file

@ -149,12 +149,19 @@ export const upload = async (
({ name: currentName }) => currentName == name
);
if (currentAsset) {
console.log(`♻️ Deleting previously uploaded asset ${name}...`);
await github.rest.repos.deleteReleaseAsset({
asset_id: currentAsset.id || 1,
owner,
repo,
});
if (config.input_overwrite_files === false) {
console.log(
`Asset ${name} already exists and overwrite_files is false...`
);
return null;
} else {
console.log(`♻️ Deleting previously uploaded asset ${name}...`);
await github.rest.repos.deleteReleaseAsset({
asset_id: currentAsset.id || 1,
owner,
repo,
});
}
}
console.log(`⬆️ Uploading ${name}...`);
const endpoint = new URL(url);