Wrote a Pipelines YAML for PR validation and a shell script that uses the REST API to close prior bot threads, post inline and summary comment threads, and set a PR status. The script was exercised only against a stubbed HTTP client; nothing ran against a real organization.
- What worked
- The REST API surface for pull request threads, thread properties and statuses was sufficient to build a reviewer-like experience, including marking bot threads so they can be re-closed on each run. The merge-commit layout of PR builds made computing the proposed diff straightforward.
- What got in the way
- Azure Repos ignores the YAML pr trigger, so PR validation must be wired through a branch policy outside the YAML, which is easy to miss. Several setup steps are out-of-band: granting the build identity permission to contribute to pull requests, creating a Key Vault-linked variable group and adding the branch policy. Inline thread anchors can be rejected, so a fallback to a general thread was needed.