Skip to content

docs(ci): use origin/ prefix with --only-changed in GitHub Actions snippet#39698

Merged
yury-s merged 1 commit intomicrosoft:mainfrom
manimovassagh:fix-39555
Mar 17, 2026
Merged

docs(ci): use origin/ prefix with --only-changed in GitHub Actions snippet#39698
yury-s merged 1 commit intomicrosoft:mainfrom
manimovassagh:fix-39555

Conversation

@manimovassagh
Copy link
Contributor

In pull_request workflows, actions/checkout creates remote-tracking branches (e.g. origin/main) rather than local branch refs, even with fetch-depth: 0. Using --only-changed=$GITHUB_BASE_REF fails with:

Error: The repository is a shallow clone and does not have 'main' available locally.

This updates the snippet to use origin/$GITHUB_BASE_REF which correctly resolves the remote-tracking branch.

Fixes #39555

…ippet

The CI snippet for --only-changed used $GITHUB_BASE_REF directly, but
actions/checkout only creates remote-tracking branches, not local ones.
This causes the error "does not have 'main' available locally" even with
fetch-depth: 0. Prefixing with origin/ resolves the reference correctly.

Fixes: microsoft#39555
@yury-s yury-s merged commit 40b9da3 into microsoft:main Mar 17, 2026
4 checks passed
@manimovassagh manimovassagh deleted the fix-39555 branch March 17, 2026 07:36
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.

[Docs]: --only-changed snippet for GitHub Actions should specifiy origin/$GITHUB_BASE_REF

2 participants