Skip to content

Instantly share code, notes, and snippets.

@jnm
Created June 25, 2018 22:21
Show Gist options
  • Save jnm/bf9311d7f685e02ed644a65c3c67abaf to your computer and use it in GitHub Desktop.
Save jnm/bf9311d7f685e02ed644a65c3c67abaf to your computer and use it in GitHub Desktop.
Copy GitHub project cards between boards
import requests
headers = {'Authorization': 'token <ahem>', 'Accept': ' application/vnd.github.inertia-preview+json'}
# e.g. from https://api.github.com/repos/jnm/cuddly-doodle/projects
get_url = 'https://api.github.com/projects/columns/2942196/cards'
# e.g. from https://api.github.com/orgs/kobotoolbox/projects
post_url = 'https://api.github.com/projects/columns/2942356/cards'
source = requests.get(get_url, headers=headers).json()
for card in reversed(source):
response = requests.post(post_url, headers=headers, json={'note': card['note']})
response.raise_for_status()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment