问题
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.
回答1:
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.
回答2:
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. 🚮
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.
回答3:
Due to legal problems I've had to delete several issues with many comments of a project. I did as follows:
- Deleting all comments
- Editing the text of the issue ("THIS ISSUE WAS DELETED AND BLOCKED")
- 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)
})()
来源:https://stackoverflow.com/questions/16527600/github-remove-issues-entered-in-error