TimothyBritt / github-issue-migrate

A simple, interactive Ruby class that helps you migrate issues from one repository to another
10 stars 4 forks source link

"Abuse detected" when trying to migrate issues #2

Open fabacab opened 8 years ago

fabacab commented 8 years ago

Hi, this library is exactly what I was looking for today. Unfortunately, I am not fluent in Ruby so I don't know how to code a solution to this issue myself.

It appears this library triggers GitHub's rate limit. The output when I tried to use this to migrate 84 issues:

irb(main):006:0> im.push_issues
Octokit::AbuseDetected: POST https://api.github.com/repos/owner/destination_repo/issues/17/comments: 403 - You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later. // See: https://developer.github.com/v3#abuse-rate-limits
    from /Library/Ruby/Gems/2.0.0/gems/octokit-3.8.0/lib/octokit/response/raise_error.rb:16:in `on_complete'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/response.rb:9:in `block in call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/connection.rb:177:in `post'
    from /Library/Ruby/Gems/2.0.0/gems/sawyer-0.6.0/lib/sawyer/agent.rb:94:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/octokit-3.8.0/lib/octokit/client.rb:339:in `request'
    from /Library/Ruby/Gems/2.0.0/gems/octokit-3.8.0/lib/octokit/client.rb:144:in `post'
    from /Library/Ruby/Gems/2.0.0/gems/octokit-3.8.0/lib/octokit/client/issues.rb:254:in `add_comment'
    from /Users/me/src/github-issue-migrate/lib/issue_migrator.rb:47:in `block in push_comments'
    from /Users/me/src/github-issue-migrate/lib/issue_migrator.rb:46:in `each'
    from /Users/me/src/github-issue-migrate/lib/issue_migrator.rb:46:in `push_comments'
    from /Users/me/src/github-issue-migrate/lib/issue_migrator.rb:24:in `block in push_issues'
    from /Users/me/src/github-issue-migrate/lib/issue_migrator.rb:20:in `each'
    from /Users/me/src/github-issue-migrate/lib/issue_migrator.rb:20:in `push_issues'
    from (irb):6
    from /usr/bin/irb:12:in `<main>'irb(main):007:0> 

Any advice on how to avoid this?

Also, if I simply wait and do this again later, will I be creating duplicate issues? Can I tell the push_issues method to start migrating issues after the last previously-migrated issue?

Thanks again!

andreasbaumann commented 5 years ago

You can add a 'sleep(10)' after importing an issue in order not to hit the rate limit of the Github API.