GitHub Release Team

I am trying to uninstall a release on github, so I do

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

This removes the tag (local and remote), but leaves GitHub in the Draft release, which I also want to remove.

I can remove it by going to GitHub and clicking the "Delete" button, but I want to avoid this through the website.

Is there a team to achieve this? I found some other similar tag removal messages, but they are all sent to GitHub to remove the Draft .

Edit

The answer is accepted on this question. 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 you to delete the project on the GitHub website, and not through the team.

+6
source share
2 answers

Releases are not something git CLI can help you.

Releases are a specific thing on GitHub.

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

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

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

  • Get API token with appropriate permissions.
  • Save it somewhere, for example, environment variables.
  • Write some scripts.

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

+6
source

I also had to do this. Anton Sizikovโ€™s answer is right, but working with github api directly can sometimes be a little complicated.

hub had a problem with this , and PR is now merged ๐ŸŽ‰

To remove the release, all you have to do is install hub and run it inside the project folder:

 hub release delete <TAG> 

You can remove all issues with something like this

 git fetch --all --tags git tag | xargs hub release delete 

Or you can list all the tags that you want to remove in the file (one tag per line), then follow these steps:

 cat tags_i_want_to_delete.txt | xargs hub release delete 

See TL; DR xargs more details.

Alternative solution: working nodejs example for removing draft tags

Thanks to Steve Mao for github-remove-all-releases !

 npm init npm install --save github-remove-all-releases dotenv 

main.js :

 require('dotenv').config(); var githubRemoveAllReleases = require('github-remove-all-releases'); var AUTH = { type: 'oauth', token: process.env.GITHUB_TOKEN }; // this is where the magic happens, we filter on tag.draft, if it true, it will get deleted a_filter = function (tag) { return Boolean(tag.draft); }; a_callback = function (result) { console.log (result); }; githubRemoveAllReleases(AUTH, process.env.GITHUB_OWNER, process.env.GITHUB_REPO, a_callback, a_filter); 

Get yourself a token and create the .env file as follows:

 GITHUB_OWNER=owner GITHUB_REPO=repo GITHUB_TOKEN=your_token 

Then run this (several times, since it does not support pagination):

 npm main.js 
0
source

All Articles