17

Dozens of issues have been entered into my project on github that have no place there. Some Einstein ran a script and created all these nonsensical issues through the api. Nothing is linked to these issues.

Surely there is someway I can delete them, but I can't seem to find it in the docs.

recursive_acronym
  • 2,981
  • 6
  • 40
  • 59

3 Answers3

10

There is no way to actually delete the issues. What you can do, to indicate that this was a spam attack, is create a new label. You can then use the API to edit each issue to be closed and labeled with the SPAM label. Those who look at it will see the label displayed along side the issue and it's really the best you can hope for.

If you're more comfortable with a specific language, check for a library written in it to make your life easier too.

Ian Stapleton Cordasco
  • 26,944
  • 4
  • 67
  • 72
10

Since Nov. 2018 and this tweet... you now can delete issues (if you are an Administrator/owner of a GitHub project)

The tweet read:

You've been asking for it.

You know the issue(s).

Delete 'em.

https://pbs.twimg.com/media/Dra0v6nVYAA-MuE.jpg

Warning: there is no "Undo" for now.

This is in public beta and the documentation is "Deleting an issue"

When you delete an issue, collaborators do not receive a notification. If you visit the URL of a deleted issue, you'll see a message that says the issue was deleted.

By default, you can only delete issues in a repository owned by your user account. As a collaborator in a repository owned by an individual user account, you cannot delete issues.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Due to legal problems I've had to delete several issues with many comments of a project. I did as follows:

  1. Deleting all comments
  2. Editing the text of the issue ("THIS ISSUE WAS DELETED AND BLOCKED")
  3. Blocking the issue

Copy paste on browser address bar:

javascript:(function(){ $('.delete-button.octicon.octicon-x.js-comment-delete').each(function(){ href=$(this).attr("href"); if(href!==undefined) { console.log("DELETING: "+href); $.ajax({type:"DELETE",url:href}); } }); firstCommentToedit=$('form.js-comment-update')[0]; $.ajax({ type:"POST", url:firstCommentToedit.action, data:{ _method:$(firstCommentToedit).find('input[name=_method]').val(), "issue[body]":"THIS ISSUE WAS DELETED AND BLOCKED", authenticity_token:$(firstCommentToedit).find('input[name=authenticity_token]').val() } }); lockLink=$('a[href$="/lock"]')[0]; if (lockLink!==undefined) { $.ajax({ type:"POST", url:lockLink.href, data:{_method:$(lockLink).attr("data-method")} }); } setTimeout(function(){window.location=window.location;},3000) })()

Expanded:

javascript: (function() {
    $('.delete-button.octicon.octicon-x.js-comment-delete').each(function() {
        href = $(this).attr("href");
        if (href !== undefined) {
            console.log("DELETING: " + href);
            $.ajax({
                type: "DELETE",
                url: href
            });
        }
    });
    firstCommentToedit = $('form.js-comment-update')[0];
    $.ajax({
        type: "POST",
        url: firstCommentToedit.action,
        data: {
            _method: $(firstCommentToedit).find('input[name=_method]').val(),
            "issue[body]": "THIS ISSUE WAS DELETED AND BLOCKED",
            authenticity_token: $(firstCommentToedit).find('input[name=authenticity_token]').val()
        }
    });
    lockLink = $('a[href$="/lock"]')[0];
    if (lockLink !== undefined) {
        $.ajax({
            type: "POST",
            url: lockLink.href,
            data: {
                _method: $(lockLink).attr("data-method")
            }
        });
    }
    setTimeout(function() {
        window.location = window.location;
    }, 3000)
})()
aabilio
  • 1,697
  • 12
  • 19
  • What does item #3 do? – Gaia Oct 05 '16 at 07:41
  • @Gaia I edited the answer. The code was a "shortcut" to automatically do the steps described above. I do not know if it still works (it depends on whether GitHub has changed class names). – aabilio Oct 05 '16 at 08:41
  • Example: issue "deleted" with this method: https://github.com/aabilio/PyDownTV2/issues/135 – aabilio Oct 05 '16 at 08:48