[CI] Checkout the head ref rather than the merge or a reset, this should fix issues with the test selector. (#14496)

This commit is contained in:
Manuel de la Pena 2022-03-25 11:38:52 -04:00 коммит произвёл GitHub
Родитель ab513555a6
Коммит d36d87f11e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -164,8 +164,8 @@ namespace Xharness {
IEnumerable<string> GetModifiedFilesLocally (int pullRequest)
{
var base_commit = $"origin/pr/{pullRequest}/merge^";
var head_commit = $"origin/pr/{pullRequest}/merge";
var base_commit = $"origin/pull/{pullRequest}/merge^";
var head_commit = $"origin/pull/{pullRequest}/merge";
harness.Log ("Fetching modified files for commit range {0}..{1}", base_commit, head_commit);

Просмотреть файл

@ -52,7 +52,13 @@ steps:
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- pwsh: |
git reset --hard HEAD^2
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
git fetch origin
$branch="$(Build.SourceBranch)".Replace("merge", "head")
$branch=$branch.Replace("refs", "origin")
Write-Host "Checking out branch $branch"
git checkout $branch
git branch -a
displayName: "Undo Github merge"
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios

Просмотреть файл

@ -54,7 +54,13 @@ steps:
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- pwsh: |
git reset --hard HEAD^2
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
git fetch origin
$branch="$(Build.SourceBranch)".Replace("merge", "head")
$branch=$branch.Replace("refs", "origin")
Write-Host "Checking out branch $branch"
git checkout $branch
git branch -a
displayName: "Undo Github merge"
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios