开发者

Delete a tag with github v3 API

开发者 https://www.devze.com 2023-03-31 15:43 出处:网络
I can create an a开发者_Python百科nnotated tag using the GitHub v3 API by following their directions. I create the tag object, then the ref object. Everything good there.

I can create an a开发者_Python百科nnotated tag using the GitHub v3 API by following their directions. I create the tag object, then the ref object. Everything good there.

I can delete the reference like this:

curl -X DELETE -i -u 'myuser:mypassword' https://api.github.com/repos/:user/:repo/git/refs/tags/ben-test-310

Unfortunately this doesn't seem to be sufficient. How do I fully delete the tag using the API?


The API supports this now. It's called "deleting a ref" (delete_ref):

https://docs.github.com/en/rest/reference/git#delete-a-reference

Here it is in the Ruby SDK also, just for example: https://octokit.github.io/octokit.rb/Octokit/Client/Refs.html


Had to figure out that I needed to prepend /tags before the tag I wanted to delete but it's not mentioned in https://docs.github.com/en/rest/reference/git#delete-a-reference.

Here's the full command for reference:

curl \
  -X DELETE \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer {GITHUB_TOKEN}" \
  "https://api.github.com/repos/{username}/{repo}/git/refs/tags/{tag}"
0

精彩评论

暂无评论...
验证码 换一张
取 消