From 179f160651f35f8c76d2a476cdfcbd4171a84a3e Mon Sep 17 00:00:00 2001 From: Zakary Timson Date: Fri, 15 Dec 2023 02:47:47 +0000 Subject: [PATCH] Add copy-labels.py --- copy-labels.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 copy-labels.py diff --git a/copy-labels.py b/copy-labels.py new file mode 100644 index 0000000..b5f27b1 --- /dev/null +++ b/copy-labels.py @@ -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}')