Query for existing assets and then delete
This commit is contained in:
parent
2b676b63b1
commit
8fb2c209a9
11
publish.py
11
publish.py
@ -285,7 +285,6 @@ class GitHub(Base): # {{{
|
||||
upload_url = release['upload_url'].partition('{')[0]
|
||||
asset_url = f'{self.url_base}/assets/{{}}'
|
||||
existing_assets = self.existing_assets(release['id'])
|
||||
original_existing_assets = existing_assets.copy()
|
||||
|
||||
def delete_asset(asset_id: str) -> None:
|
||||
r = self.requests.delete(asset_url.format(asset_id))
|
||||
@ -318,9 +317,13 @@ class GitHub(Base): # {{{
|
||||
try:
|
||||
asset_id = r.json()['id']
|
||||
except Exception:
|
||||
asset_id = original_existing_assets[fname]
|
||||
self.info(f'Deleting {fname} from GitHub with id: {asset_id}')
|
||||
delete_asset(asset_id)
|
||||
try:
|
||||
asset_id = self.existing_assets(release['id'])[fname]
|
||||
except KeyError:
|
||||
asset_id = 0
|
||||
if asset_id:
|
||||
self.info(f'Deleting {fname} from GitHub with id: {asset_id}')
|
||||
delete_asset(asset_id)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
if self.is_nightly:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user