Reputation: 1615
I have a asset in my latest release which I want to overwrite.
I am using Github Api to get upload url of latest release assets (username and token is optional here).
upload_url=$(curl -sL userName:token https://api.github.com/repos/actions/checkout/releases/latest | jq -r '.upload_url')
This can be used to upload asset to that url but if there is an existing asset with same name then it throws error.
So I want a way to update or delete that asset...
Github api has endpoints(update, delete) to do it but can you help me with these curl commands? how do I do it.
Upvotes: 6
Views: 3009
Reputation: 166
gh release create
now takes a --clobber
argument which replaces existing assets. Docs.
Upvotes: 0
Reputation: 1324733
So I want a way to update or delete that asset...
GitHub CLI gh 2.5.0 now has gh release delete-asset
, from PR 4416 and issue 4258
gh release delete-asset <tag> <asset-name> [flags]
It wraps the appropriate GitHub API endpoint;
DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}
Upvotes: 3