aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels van Velzen <nielsvanvelzen@users.noreply.github.com>2022-12-30 16:08:02 +0100
committerGitHub <noreply@github.com>2022-12-30 08:08:02 -0700
commitc73c7b60506e61638f70c69506e58353e06f4a41 (patch)
treeb9d4cde4ac78ee42e7732aab2f6d803c94248921
parent431919301d7a2a81dda53afd16012a74f8073db9 (diff)
Checkout common ancestor for comparison in OpenAPI workflow (#8985)
-rw-r--r--.github/workflows/openapi.yml10
1 files changed, 9 insertions, 1 deletions
diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml
index f426357a9..5dee03ef8 100644
--- a/.github/workflows/openapi.yml
+++ b/.github/workflows/openapi.yml
@@ -41,7 +41,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
with:
- ref: ${{ github.base_ref }}
+ ref: ${{ github.event.pull_request.head.sha }}
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ fetch-depth: 0
+ - name: Checkout common ancestor
+ run: |
+ git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }}
+ git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/*
+ ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/${{ github.head_ref }})
+ git checkout --progress --force $ANCESTOR_REF
- name: Setup .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
with: