mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 06:16:01 +00:00
feat: add input option overwrite_files. (#343)
Some checks are pending
main / build (push) Waiting to run
Some checks are pending
main / build (push) Waiting to run
* Add input option overwrite_files. * Fix description. * update test and run fmt/build Signed-off-by: Rui Chen <rui@chenrui.dev> --------- Signed-off-by: Rui Chen <rui@chenrui.dev> Co-authored-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
parent
5822334cb4
commit
605f567f95
7 changed files with 50 additions and 18 deletions
|
@ -168,12 +168,19 @@ export const upload = async (
|
|||
({ name: currentName }) => currentName == alignAssetName(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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue