.yaml: use HEAD commit ref for PR builds

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
This commit is contained in:
Thilo Fromm 2023-03-27 18:14:33 +02:00
parent f1e3b30537
commit bed3bf87d4
2 changed files with 31 additions and 0 deletions

View File

@ -76,6 +76,21 @@ jobs:
fetch-depth: 0
submodules: true
# Hack alert: actions/checkout will check out the (disjunct) merge commit of a PR
# instead of its head commit. That commit is not connected to any branch.
# This causes breakage downstream e.g. when the devcontainer test wants to check out
# the ref in the scripts repo that corresponds to this build.
- name: If this is a PR build, use head commit instead of the merge commit
if: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
exec 2>&1
set -x
set -euo pipefail
git checkout ${{ github.event.pull_request.head.sha }}
git submodule update
- name: Set environment
shell: bash
run: |

View File

@ -60,6 +60,22 @@ jobs:
fetch-depth: 0
submodules: true
# Hack alert: actions/checkout will check out the (disjunct) merge commit of a PR
# instead of its head commit. That commit is not connected to any branch.
# This is not technically necessary for the tests run but it is done to remain aligned
# with the ref.
- name: If this is a PR build, use head commit instead of the merge commit
if: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
exec 2>&1
set -x
set -euo pipefail
cd scripts
git checkout ${{ github.event.pull_request.head.sha }}
git submodule update
- name: Download binpkgs
if: ${{ !inputs.workflow_run_id }}
uses: actions/download-artifact@v3