Skip to content

Pipeline: fix loc/notice PR base branch for non-master runs - #40510

Merged
Ben Hillis (benhillis) merged 1 commit into
masterfrom
user/benhill/fix-loc-pipeline-target-branch
May 12, 2026
Merged

Ben Hillis (benhillis) merged 1 commit into
masterfrom
user/benhill/fix-loc-pipeline-target-branch

Conversation

@benhillis

Copy link
Copy Markdown
Member

The nightly localization and notice pipelines derived the PR target branch from Build.SourceBranchName, which Azure DevOps documents as the leaf segment after the last / in the source ref. For refs/heads/master that round-trips (master), so scheduled runs work — but a manual queue against any branch with slashes (e.g. user/benhill/loc-pipeline-debug) sends only the leaf as the PR base, which GitHub rejects with:

422 Validation Failed
{"resource":"PullRequest","field":"base","code":"invalid"}

This was surfaced by manually queueing wsl-build-nightly-localization against user/benhill/loc-pipeline-debug with diagnostic instrumentation in create-change.py (separate branch). The pipeline POSTed "base": "loc-pipeline-debug" instead of "base": "user/benhill/loc-pipeline-debug".

Same bug exists in wsl-build-notice.yml (the line was copy-pasted in #14492 when the target branch was first parameterized) — the truncation case had simply never been exercised because the schedule only runs on master.

Fix: derive targetBranch from Build.SourceBranch and strip the refs/heads/ prefix at runtime so the full branch name is preserved. master nightlies are unaffected (refs/heads/master -> master).

Both wsl-build-nightly-localization.yml and wsl-build-notice.yml derived
the PR target branch from Build.SourceBranchName, which Azure DevOps
documents as the leaf segment after the last '/' in the source ref. For
refs/heads/master that happens to round-trip ('master'), so scheduled
runs work; but a manual queue against any branch with slashes (e.g.
user/benhill/loc-pipeline-debug) sends only the leaf
('loc-pipeline-debug') as the PR base, which GitHub rejects with 422
Validation Failed: base invalid.

This is the same bug PR #14492 introduced when it parameterized the
target branch -- the truncation case was never exercised because the
real schedule only runs on master.

Use Build.SourceBranch and strip the 'refs/heads/' prefix at runtime so
the full branch name is preserved. master nightlies are unaffected
('refs/heads/master' -> 'master').

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 12, 2026 19:47
@benhillis
Ben Hillis (benhillis) requested a review from a team as a code owner May 12, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the targetBranch value used by the nightly localization and notice pipelines when manually queued against branches that contain /, ensuring the GitHub PR “base” branch is valid and matches the full branch name.

Changes:

  • Switch targetBranch derivation from Build.SourceBranchName (leaf-only) to Build.SourceBranch with refs/heads/ stripped.
  • Add an inline comment in the localization pipeline explaining the truncation issue and why the new logic is required.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.pipelines/wsl-build-notice.yml Computes targetBranch from the full source ref to preserve slash-containing branch names for PR creation.
.pipelines/wsl-build-nightly-localization.yml Same targetBranch fix as notice pipeline, plus added documentation explaining the 422 base-branch failure mode.

@benhillis
Ben Hillis (benhillis) enabled auto-merge (squash) May 12, 2026 20:15
@benhillis
Ben Hillis (benhillis) merged commit 1a2672d into master May 12, 2026
15 checks passed
@benhillis
Ben Hillis (benhillis) deleted the user/benhill/fix-loc-pipeline-target-branch branch May 12, 2026 21:26
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.

3 participants