Add copy-labels.py
This commit is contained in:
parent
ec96fe0361
commit
179f160651
17
copy-labels.py
Normal file
17
copy-labels.py
Normal 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}')
|
Loading…
Reference in New Issue
Block a user