snippits/copy-labels.py

18 lines
554 B
Python
Raw Normal View History

2023-12-14 21:47:47 -05:00
import requests
HOST = 'https://git.zakscode.com'
SOURCE = 'ztimson/template'
TARGET = ''
TOKEN = ''
print(f'Copying from: {HOST}/api/v1/repos/{SOURCE}/labels')
print(f'To: {HOST}/api/v1/repos/{TARGET}/labels')
labels = requests.get(f'{HOST}/api/v1/repos/{SOURCE}/labels').json()
for l in labels:
print(f'Adding: {l["name"]}')
del l['id']
resp = requests.post(f'{HOST}/api/v1/repos/{TARGET}/labels?token={TOKEN}', data=l)
if resp.status_code > 299:
print(f'Failed: {resp.status_code}')