Skip to content

Commit

Permalink
fetch collections as well as categories -- though we can likely drop …
Browse files Browse the repository at this point in the history
…categories as unused
  • Loading branch information
dannon committed Dec 19, 2024
1 parent c93e687 commit e70ae68
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions scripts/workflow_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def get_dockstore_details(trsID):

details = None
categories = []
collections = []

if response.status_code == 200:
details = response.json()
Expand All @@ -45,11 +46,24 @@ def get_dockstore_details(trsID):
print(
f"Failed to get categories. Status code: {cat_response.status_code}"
)

# With the ID, request collections
url_collections = f"https://dockstore.org/api/entries/{entry_id}/collections"
collection_response = requests.get(url_collections)

if collection_response.status_code == 200:
collections_data = collection_response.json()
for collection in collections_data:
collections.append(collection["collectionDisplayName"])
else:
print(
f"Failed to get collections. Status code: {collection_response.status_code}"
)
else:
print("No 'id' field found in the top-level data.")
else:
print(f"Failed to retrieve details. Status code: {response.status_code}")
return details, categories
return details, categories, collections


def find_and_load_compliant_workflows(directory):
Expand Down Expand Up @@ -125,10 +139,11 @@ def find_and_load_compliant_workflows(directory):
trsID = f"#workflow/github.com/iwc-workflows/{dirname}/{workflow['name'] or 'main'}"
workflow["trsID"] = trsID

dockstore_details, categories = get_dockstore_details(trsID)
dockstore_details, categories, collections = get_dockstore_details(trsID)

workflow["dockstore_id"] = dockstore_details["id"]
workflow["categories"] = categories
workflow["collections"] = collections

workflow_test_path = f"{workflow_path.rsplit('.ga', 1)[0]}-tests.yml"
if os.path.exists(workflow_test_path):
Expand Down

0 comments on commit e70ae68

Please sign in to comment.