Skip to content

Instantly share code, notes, and snippets.

@DeviaVir
Created January 2, 2018 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeviaVir/a5da26a67326ba7e26b8ec824ee321d8 to your computer and use it in GitHub Desktop.
Save DeviaVir/a5da26a67326ba7e26b8ec824ee321d8 to your computer and use it in GitHub Desktop.
Automate moving github issues. Make sure to log in to github (authorize button) within 30 seconds after the first browser window opens. This will hit the rate limits and block you for an hour if you over use it.
#!/usr/bin/env python3
import requests
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
urls = []
page = -1
response = True
while response:
page = page+1
payload = {'state': 'open', 'page': page}
headers = {'Authorization': 'token <REDACTED>'}
r = requests.get('https://api.github.com/repos/<redacted>/<redacted>/issues', params=payload, headers=headers)
try:
response = r.json()
except:
response = False
if response:
for issue in response:
urls.append(issue['url'])
print(urls)
driver = webdriver.Chrome()
executor_url = driver.command_executor._url
session_id = driver.session_id
driver.get("https://github-issue-mover.appspot.com/")
wait = True
seconds = 0
while wait:
seconds += 1
if seconds == 29:
wait = False
print('{} seconds'.format(seconds))
time.sleep(1)
for url in urls:
url = url.replace('api.github.com/repos/', 'github.com/')
driver.find_element_by_id('issue').send_keys(url)
driver.find_element_by_id('repo').send_keys('<redacted>/<redacted>')
driver.find_element_by_id('repo').send_keys(Keys.RETURN)
time.sleep(2)
driver.find_element_by_id('move').click()
time.sleep(30)
driver.get("https://github-issue-mover.appspot.com/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment