Azure DevOps workflow automation library — PR context, repository discovery, and SDK client wrappers
Project description
ado-workflows
Azure DevOps workflow automation library — PR review analysis, comment lifecycle, repository discovery, and Python SDK wrappers.
Install
pip install ado-workflows
Quick Start
from ado_workflows import ConnectionFactory, AdoClient
# Authenticate (uses DefaultAzureCredential — Azure CLI, managed identity, etc.)
factory = ConnectionFactory()
connection = factory.get_connection("https://dev.azure.com/MyOrg")
client = AdoClient(connection)
PR Review Status
from ado_workflows import get_review_status
status = get_review_status(client, "MyProject", "MyRepo", pr_id=12345)
print(status.approval_status) # ApprovalStatus.APPROVED / PENDING / REJECTED
print(status.total_reviewers) # 3
print(status.required_approvals) # 2
for vs in status.vote_statuses:
print(f"{vs.name}: {vs.vote_text} (stale: {vs.vote_invalidated})")
Pending Review Analysis
from ado_workflows import analyze_pending_reviews
result = analyze_pending_reviews(
client, "MyProject", "MyRepo",
max_days_old=14,
creator_filter="alice",
)
for pr in result.pending_prs: # sorted by days_open descending
print(f"PR #{pr.pr_id} ({pr.days_open}d): {pr.title}")
print(f" Needs {pr.needs_approvals_count} more approvals")
for r in pr.pending_reviewers:
print(f" - {r.display_name}")
Comment Operations
from ado_workflows import (
analyze_pr_comments,
post_comment,
reply_to_comment,
resolve_comments,
)
# Analyze threads
analysis = analyze_pr_comments(client, "MyProject", "MyRepo", pr_id=12345)
print(f"{analysis.summary.active_count} active, {analysis.summary.resolved_count} resolved")
# Post, reply, resolve
thread_id = post_comment(client, "MyProject", "MyRepo", pr_id=12345, content="LGTM")
reply_to_comment(client, "MyProject", "MyRepo", pr_id=12345, thread_id=thread_id, content="Thanks!")
result = resolve_comments(client, "MyProject", "MyRepo", pr_id=12345, thread_ids=[thread_id])
print(f"Resolved: {result.resolved}, Failed: {result.failed}")
Repository Discovery
from ado_workflows import discover_repositories, parse_ado_url
# Parse any Azure DevOps URL
org, project, repo, pr_id = parse_ado_url(
"https://dev.azure.com/MyOrg/MyProject/_git/MyRepo/pullrequest/42"
)
# Discover git repos in a workspace
repos = discover_repositories("/path/to/workspace")
for r in repos:
print(f"{r['name']} → {r['remote_url']}")
PR Context
from ado_workflows import establish_pr_context
# From a URL
ctx = establish_pr_context("https://dev.azure.com/MyOrg/MyProject/_git/MyRepo/pullrequest/42")
# From a PR ID (requires RepositoryContext to be set)
ctx = establish_pr_context(42, working_directory="/path/to/repo")
print(ctx.org_url) # https://dev.azure.com/MyOrg
print(ctx.pr_id) # 42
Architecture
Three-layer API:
| Layer | Purpose | State | SDK dependency |
|---|---|---|---|
| 1 — Primitives | URL parsing, git inspection, date parsing | None | None |
| 2 — Context | Repository context caching | Thread-safe | None |
| 3 — PR Operations | Review, comments, lifecycle, pending analysis | Composes L1+L2 | azure-devops |
See docs/ARCHITECTURE.md for full design rationale.
Error Handling
All errors are ActionableError instances (from actionable-errors) with structured context:
from actionable_errors import ActionableError
try:
status = get_review_status(client, "MyProject", "MyRepo", pr_id=99999)
except ActionableError as e:
print(e.error_type) # ErrorType.CONNECTION
print(e.service) # "AzureDevOps"
print(e.suggestion) # "Verify the PR ID exists and you have read access..."
Development
uv sync --extra dev
task check # lint + type-check + test
See CONTRIBUTING.md for full development setup and coding standards.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ado_workflows-0.7.2.tar.gz.
File metadata
- Download URL: ado_workflows-0.7.2.tar.gz
- Upload date:
- Size: 175.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3c25f1de0b2d74939e10d68e7de0a81af1658a1133fa0748f91b5b91ef9ddae
|
|
| MD5 |
6b30293a8a25fa0dea6d966f0b6e3289
|
|
| BLAKE2b-256 |
84b8127ac9090254f705fada20a0217e65ee2e1286d7d0e2cb7d9c594cb1aa1d
|
Provenance
The following attestation bundles were made for ado_workflows-0.7.2.tar.gz:
Publisher:
release.yml on grimlor/ado-workflows
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ado_workflows-0.7.2.tar.gz -
Subject digest:
f3c25f1de0b2d74939e10d68e7de0a81af1658a1133fa0748f91b5b91ef9ddae - Sigstore transparency entry: 1237895311
- Sigstore integration time:
-
Permalink:
grimlor/ado-workflows@f1cb4b9d7e3fe08c2e976d7a868bd7a80d33c20f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/grimlor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f1cb4b9d7e3fe08c2e976d7a868bd7a80d33c20f -
Trigger Event:
push
-
Statement type:
File details
Details for the file ado_workflows-0.7.2-py3-none-any.whl.
File metadata
- Download URL: ado_workflows-0.7.2-py3-none-any.whl
- Upload date:
- Size: 45.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3135c55359cfdda7f168bd7388dabeeb5b4c97b65ad0b7308ce20a86ea6f76b9
|
|
| MD5 |
eb6c8850ab31e73d186f0e81c0fccde8
|
|
| BLAKE2b-256 |
6fe906e102049b6be1b5a27eab47138419c6d59643b91e386ae5b3275c8100b3
|
Provenance
The following attestation bundles were made for ado_workflows-0.7.2-py3-none-any.whl:
Publisher:
release.yml on grimlor/ado-workflows
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ado_workflows-0.7.2-py3-none-any.whl -
Subject digest:
3135c55359cfdda7f168bd7388dabeeb5b4c97b65ad0b7308ce20a86ea6f76b9 - Sigstore transparency entry: 1237895314
- Sigstore integration time:
-
Permalink:
grimlor/ado-workflows@f1cb4b9d7e3fe08c2e976d7a868bd7a80d33c20f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/grimlor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f1cb4b9d7e3fe08c2e976d7a868bd7a80d33c20f -
Trigger Event:
push
-
Statement type: