merge: Explicitly check if a target repo already exists in the org

This commit is contained in:
bbhtt
2025-06-08 07:43:12 +05:30
parent 533839f41c
commit 2c602e1e0c
+16
View File
@@ -176,6 +176,22 @@ def main():
print(f"Detected {appid} as appid from {manifest_file}")
try:
org.get_repo(appid)
print(
f"Repository {appid} already exists in the flathub organisation, exiting."
)
sys.exit(1)
except github.GithubException as err:
if err.status == 404:
print(
f"Repository {appid} does not exist in the flathub organisation, continuing."
)
pass
else:
print(f"Unexpected error while checking for repository {appid}: {err}")
raise
print("Creating new repo on Flathub")
repo = org.create_repo(appid)
time.sleep(5)