Skip to content

Instantly share code, notes, and snippets.

@pombredanne
Forked from jnm/copy-github-cards.py
Created August 8, 2024 16:09
Show Gist options
  • Save pombredanne/8f1077aa710f4053ada5272d4af7bd16 to your computer and use it in GitHub Desktop.
Save pombredanne/8f1077aa710f4053ada5272d4af7bd16 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