Skip to content

Fix incorrect Azure DevOps PR URL in review markdown output - #21

Merged
richardthombs merged 2 commits into
mainfrom
copilot/fix-pr-output-url
Mar 19, 2026
Merged

richardthombs merged 2 commits into
mainfrom
copilot/fix-pr-output-url

Conversation

Copilot AI commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Azure DevOps PR URLs use /pullrequest/{id}, but the review output was emitting /pull/{id} — a format only valid for GitHub. The fix uses the canonical URL from the ADO CLI/API, falling back to the input URL when enrichment is unavailable.

Changes

  • types.PRRef — Added PRURL string field to carry the canonical PR web URL through the pipeline.
  • pr_url.go — Populates PRURL on parse with the correctly-formatted URL (/pullrequest/{id} for ADO, /pull/{id} for GitHub), serving as the fallback.
  • resolver.go — ResolveFromPullRequestURL carries PRURL from the parsed context into the returned PRRef.
  • enricher.go — enrichAzureDevOps now queries _links.web.href via az repos pr show to capture the canonical ADO web URL, overriding the parsed fallback when available.
  • render.go — renderMarkdown/renderPRLine now accept a pre-built prURL directly rather than reconstructing from repoURL + prID.
  • review.go — Uses prRef.PRURL when set; falls back to buildPRURL(repoURL, prID) (preserving existing GitHub behaviour).

Before / after:

# Before
PR: [#85820](https://dev.azure.com/ensekltd/blackbird/_git/blackbird/pull/85820)

# After
PR: [#85820](https://dev.azure.com/ensekltd/blackbird/_git/blackbird/pullrequest/85820)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/acme/repo/pulls/42
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/42 --jq .base.ref,.base.sha (http block)
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/42 --jq .base.ref,.base.sha ux-amd64/src/run. (http block)
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/42 --jq .base.ref,.base.sha ux-amd64/src/run-c ux-amd64/src/ven-I ux-amd64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/acme/repo/pulls/73
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/73 --jq .base.ref,.base.sha ux-amd64/src/run. (http block)
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/73 --jq .base.ref,.base.sha _.a 0.1-go1.25.0.lin--64 rg/toolchain@v0.-o (http block)
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/73 --jq .base.ref,.base.sha 0.1-go1.25.0.lin-errorsas SQdUDQPIO cal/bin/git credential.helpegit (http block)
  • https://api.github.com/repos/acme/repo/pulls/77
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/77 --jq .base.ref,.base.sha /tmp/go-build521727931/b184/ -dumpbase _cgo_main.c -dumpbase-ext .c -m64 -mtune=generic 0.1-�� 0.1-go1.25.0.lin. ame ux-amd64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/77 --jq .base.ref,.base.sha 0.1-go1.25.0.lin--gdwarf-5 0.1-go1.25.0.lin--64 0.1-go1.25.0.lin-o (http block)
    • Triggering command: /usr/bin/gh gh api repos/acme/repo/pulls/77 --jq .base.ref,.base.sha 0.1-go1.25.0.linux-amd64/src/run-pthread /http/httptest/httptest.go ux-amd64/pkg/tool/linux_amd64/compile --fix-thin bis (http block)
  • https://api.github.com/repos/checkouttestuser/checkouttestrepo/pulls/987654321
    • Triggering command: /usr/bin/gh gh api repos/checkouttestuser/checkouttestrepo/pulls/987654321 --jq .base.ref,.base.sha (http block)
    • Triggering command: /usr/bin/gh gh api repos/checkouttestuser/checkouttestrepo/pulls/987654321 --jq .base.ref,.base.sha 0.1-go1.25.0.lin--gdwarf-5 --global rg/toolchain@v0.-o http.https://git/home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.linux-amd64/pkg/too-buildtags (http block)
    • Triggering command: /usr/bin/gh gh api repos/checkouttestuser/checkouttestrepo/pulls/987654321 --jq .base.ref,.base.sha ux-amd64/src/net 0.1-go1.25.0.linux-amd64/src/int--64 ux-amd64/pkg/tool/linux_amd64/vet --depth bis REDACTED status --porcelain --ignore-submodules | head -n 10 ux-amd64/pkg/tool/linux_amd64/vet conf�� _.a ZqIvYSOoH pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.lin-lang=go1.25 pull.rebase (http block)
  • https://api.github.com/repos/checkouttestuser2/checkouttestrepo2/pulls/123456789
    • Triggering command: /usr/bin/gh gh api repos/checkouttestuser2/checkouttestrepo2/pulls/123456789 --jq .base.ref,.base.sha (http block)
    • Triggering command: /usr/bin/gh gh api repos/checkouttestuser2/checkouttestrepo2/pulls/123456789 --jq .base.ref,.base.sha get 0.1-go1.25.0.lin--64 ux-amd64/src/net-o ux-amd64/src/net/home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.linux-amd64/pkg/too-trimpath ux-amd64/src/net-unsafeptr=false ux-amd64/src/net-unreachable=false ux-amd64/src/net/tmp/go-build521727931/b194/vet.cfg conf�� ux-amd64/src/net 0.1-go1.25.0.linux-amd64/src/enc/home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.lin--norc ux-amd64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api repos/checkouttestuser2/checkouttestrepo2/pulls/123456789 --jq .base.ref,.base.sha ux-amd64/src/net Gykg3C2n6 /usr/bin/git --depth 2 REDACTED git rtcf�� unset 0.1-go1.25.0.linux-amd64/src/vendor/golang.org/x/text/secure/bidirule/bidirule.go rg/toolchain@v0.0.1-go1.25.0.linux-amd64/pkg/tool/linux_amd64/compile pull.rebase (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Review output has incorrect URL for PR</issue_title>
<issue_description># Problem statement
For Azure DevOps, this was the original PR URL:
https://dev.azure.com/ensekltd/blackbird/_git/blackbird/pullrequest/85820

This was what was included in the markdown output:
https://dev.azure.com/ensekltd/blackbird/_git/blackbird/pull/85820

Requirements

Use the canonical PR URL returned by the Azure DevOps CLI or REST API. If there is no canonical URL available, then fall back to the input URL.</issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

- Add PRURL field to PRRef to store the canonical PR web URL
- Populate PRURL from URL parsing (pullrequest/ for ADO, pull/ for GitHub)
- Carry PRURL through ResolveFromPullRequestURL
- Enrich PRURL from _links.web.href via az repos pr show CLI
- Update renderMarkdown/renderPRLine to use pre-built prURL
- Fall back to buildPRURL when PRURL is not set
- Add tests for URL parsing, enrichment, and render functions

Co-authored-by: richardthombs <1511599+richardthombs@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect URL for PR in output Fix incorrect Azure DevOps PR URL in review markdown output Mar 19, 2026
Copilot AI requested a review from richardthombs March 19, 2026 14:12
@richardthombs
richardthombs marked this pull request as ready for review March 19, 2026 15:03
@richardthombs
richardthombs merged commit 8cc8e86 into main Mar 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review output has incorrect URL for PR

2 participants