Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to remove GitHub Draft release

I'm trying to delete a Release in GitHub, so I'm doing

git tag -d {release-tag-name}
git push origin :{release-tag-name}

This removes the tag (local and remote) but it leaves a Draft release in GitHub that I also want to delete.

I can delete it by login into GitHub and clicking the delete button but I want to avoid doing this through the website.

Is there a command to achieve this? I've found some other similar postings about removing tags but they all end up going to GitHub to delete the Draft.

Edit

In this question's accepted answer Step 2 and 5 are related to my question. Step 2 says This will turn your "Release" on GitHub into a Draft that you can later delete. while step 5 instructs to delete the Draft in GitHub's site, not trough a command.

like image 889
jorgehmv Avatar asked Jun 29 '16 16:06

jorgehmv


People also ask

How do I remove a tag and release in GitHub?

In order to delete a remote Git tag, use the “git push” command with the “–delete” option and specify the tag name. To delete a remote Git tag, you can also use the “git push” command and specify the tag name using the refs syntax.

What is draft release GitHub?

A GitHub action that automatically drafts a GitHub release based on a newly created version tag. The commit messages between the created version tag and the one that came before it will become the release notes.

How do I remove a local tag?

To delete the Git tag from the local repo, run the git tag -d tag-name command where tag-name is the name of the Git tag you want to delete. To get a list of Git tag names, run git tag.

How do I delete all tags?

Click Back to taggingClick the gear icon. Select Clear all tags from this page.


1 Answers

Releases are not something git CLI can help you with.

Releases are GitHub specific thing.

You can use GitHub API to create/update/delete releases.

DELETE /repos/:owner/:repo/releases/:id

If you want to automate interaction with GitHub API you can do the following:

  1. Get an API token with proper permissions.
  2. Store it somewhere, let's say environment variables.
  3. Write a few scripts.

For example in this case you can have one script to delete local tag, call API to get tag id by name, delete remote tag and delete a release.

like image 158
Anton Sizikov Avatar answered Sep 30 '22 14:09

Anton Sizikov