Coder Social home page Coder Social logo

delete-github-issues's Introduction

Delete GitHub Issues Script

This is a quick script to delete GitHub issues. It's open source.

Why would you want to delete a repository's issues?

Imagine you have a longstanding private repository that you want to open source. There are like a thousand issues... including stack traces and such. In order to open source the repository you have to delete all the issues. The author of this script had such a problem and imagines there are others in a similar jam... stuck between Octocat and Charybdis or something like that.

Can't you just delete them through the GitHub web UI?

You would think you could do that... but you can only navigate to the issue page and delete one issue at a time. For some reason GitHub doesn't seem to want to make it easy to delete issues. Also, at the time of this writing (July 5th 2020), deleting issues was only available through the GraphQL API and not through the REST API.

Instead of providing a way to lock issues from being deleted by default they just make their APIs hard to use to increase the cost of deleting issues? I dunno why, but that's how it works.

Encountering this situation you might then look for a browser extension and not find any that address the problem. If you have hundreds of issues to delete you might think to yourself "Huh. Is there a script to do that for me?"

Usage

This is a node command line script using yarn as package management.

  • Clone this repo
  • cd into the directory
  • yarn install
  • Create a GitHub Personal Access token with access rights to the repository for your profile at https://github.com/settings/tokens
  • Create a .env file with GITHUB_PERSONAL_ACCESS_TOKEN=your access token
  • Set the numberOfIssuesToDelete in the delete-issues.js file (default is 100)
  • run yarn delete-issues to delete some issues

Troubleshooting

When you are deleting several hundred issues you might get a cool down warning from GitHub saying RequestError [HttpError]: You have triggered an abuse detection mechanism. Please wait a few minutes before you try again. I suggest waiting a few minutes and then try again.

You might get an an access error for your personal access token. You may need to add more permissions for your Personal Access Token on https://github.com/settings/tokens

delete-github-issues's People

Contributors

aquabu avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.