Skip to content

Commit

Permalink
Python scripts enhancement (#740)
Browse files Browse the repository at this point in the history
* add try catch

* more debug prints
  • Loading branch information
bartkrak committed Feb 2, 2024
1 parent dbce654 commit a0e0d94
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
16 changes: 10 additions & 6 deletions scripts/python/get_author_origin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
membrane_team = json.load(sys.stdin)
pr_author = sys.argv[1]

for person in membrane_team:
if person["login"] == pr_author:
print("MEMBRANE")
sys.exit(0)

print("COMMUNITY")
try:
for person in membrane_team:
if person["login"] == pr_author:
print("MEMBRANE")
sys.exit(0)

print("COMMUNITY")
except:
print("An exception occurred, provided JSON:")
print(membrane_team)
print("provided PR_AUTHOR:", pr_author)
13 changes: 10 additions & 3 deletions scripts/python/get_ticket_id.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import sys, json;

project_items = json.load(sys.stdin)["items"]
full_json = json.load(sys.stdin)
pr_url = sys.argv[1]
[id] = [item["id"] for item in project_items if ("url" in item["content"] and item["content"]["url"] == pr_url)]
print(id)

try:
project_items = full_json["items"]
[id] = [item["id"] for item in project_items if ("url" in item["content"] and item["content"]["url"] == pr_url)]
print(id)
except:
print("An exception occurred, provided JSON:")
print(full_json)
print("provided PR_URL:", pr_url)

0 comments on commit a0e0d94

Please sign in to comment.