Add copy-labels.py

This commit is contained in:
Zakary Timson 2023-12-15 02:47:47 +00:00
parent ec96fe0361
commit 179f160651

17
copy-labels.py Normal file
View File

@ -0,0 +1,17 @@
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}')