Refactor harvester to list Markdown files across all projects and repositories
All checks were successful
/ unit-tests (push) Successful in 12s
All checks were successful
/ unit-tests (push) Successful in 12s
This commit is contained in:
17
harvester.py
17
harvester.py
@@ -1,11 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from sk.devops import Organization
|
||||
import requests
|
||||
from sk.devops import Organization, Project, Repository, Item
|
||||
from sk.azure import get_token
|
||||
|
||||
org = Organization("https://dev.azure.com/mcovsandbox", token=get_token())
|
||||
item = org["ADO Sandbox"]["ado-auth-lab"]["/"]
|
||||
|
||||
# Let's list all python files in this folder
|
||||
for child in item.get_child_items(pattern="*.py", recurse=True):
|
||||
print(f'- {child.path}')
|
||||
# Find all Markdown files in all projects and repositories
|
||||
for project in org.projects:
|
||||
for repo in project.repositories:
|
||||
try:
|
||||
root_item = Item(repository=repo, path="/")
|
||||
md_files = root_item.get_child_items(pattern="*.md", recurse=True)
|
||||
for md_file in md_files:
|
||||
print(f"Project: {project.name}, Repo: {repo.name}, File: {md_file.path}")
|
||||
except requests.exceptions.HTTPError as e:
|
||||
print(f"Repository {repo.name} is empty.")
|
||||
|
||||
Reference in New Issue
Block a user