18 lines
554 B
Python
18 lines
554 B
Python
|
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}')
|