Skip to content

Commit 8f6b7b9

Browse files
authored
Merge branch 'main' into lucas/generics-con-args
2 parents aa20a96 + 49c4ae8 commit 8f6b7b9

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

.github/workflows/build-and-test-macos.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ jobs:
235235
run: "tar xzf inst.tar.gz"
236236

237237
- name: Download Toooba
238+
env:
239+
HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
238240
run: .github/workflows/checkout_possible_branch.sh bluespec Toooba
239241

240242
# Restore previous ccache cache of compiled object files. Use a SHA
@@ -313,6 +315,8 @@ jobs:
313315
run: "tar xzf inst.tar.gz"
314316

315317
- name: Download bsc-contrib
318+
env:
319+
HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
316320
run: .github/workflows/checkout_possible_branch.sh B-Lang-org bsc-contrib
317321

318322
- name: Build and install bsc-contrib
@@ -385,6 +389,8 @@ jobs:
385389
run: "tar xzf inst.tar.gz"
386390

387391
- name: Download bdw
392+
env:
393+
HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
388394
run: .github/workflows/checkout_possible_branch.sh B-Lang-org bdw
389395

390396
- name: Build and install bdw

.github/workflows/build-and-test-ubuntu.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ jobs:
208208
run: "tar xzf inst.tar.gz"
209209

210210
- name: Download Toooba
211+
env:
212+
HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
211213
run: .github/workflows/checkout_possible_branch.sh bluespec Toooba
212214

213215
# Restore previous ccache cache of compiled object files. Use a SHA
@@ -281,6 +283,8 @@ jobs:
281283
run: "tar xzf inst.tar.gz"
282284

283285
- name: Download bsc-contrib
286+
env:
287+
HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
284288
run: .github/workflows/checkout_possible_branch.sh B-Lang-org bsc-contrib
285289

286290
- name: Build and install bsc-contrib
@@ -358,6 +362,8 @@ jobs:
358362
run: "tar xzf inst.tar.gz"
359363

360364
- name: Download bdw
365+
env:
366+
HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
361367
run: .github/workflows/checkout_possible_branch.sh B-Lang-org bdw
362368

363369
- name: Build and install bdw

.github/workflows/checkout_possible_branch.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,30 @@ default_checkout () {
1717

1818
user_branch_checkout () {
1919
if [ "$2" = "main" ]; then
20-
default_checkout
20+
default_checkout
2121
else
22-
CMD="git ls-remote --heads https://github.com/$1/${REPO} refs/heads/$2"
23-
echo "Trying: $CMD"
24-
SEARCH_RES=`$CMD`
25-
echo "Result: ${SEARCH_RES}"
26-
if [ -z "${SEARCH_RES}" ]; then
22+
CMD="git ls-remote --heads https://github.com/$1/${REPO} refs/heads/$2"
23+
echo "Trying: $CMD"
24+
SEARCH_RES=`$CMD || echo`
25+
echo "Result: ${SEARCH_RES}"
26+
if [ -z "${SEARCH_RES}" ]; then
2727
default_checkout
28-
else
28+
else
2929
echo "Checking out user's branch"
3030
git clone --recursive https://github.com/$1/${REPO} ../${REPO}
3131
cd ../${REPO}
3232
git checkout "$2"
33-
fi
33+
fi
3434
fi
3535
}
3636

3737
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
38-
user_branch_checkout "${GITHUB_ACTOR}" "${GITHUB_HEAD_REF}"
38+
if [ -z "${HEAD_OWNER}" ] ; then
39+
echo "HEAD_OWNER not defined in environment"
40+
echo "use ${{ github.event.pull_request.head.repo.owner.login }}"
41+
exit 1
42+
fi
43+
user_branch_checkout "${HEAD_OWNER}" "${GITHUB_HEAD_REF}"
3944
elif [ "${GITHUB_EVENT_NAME}" = "push" ]; then
4045
user_branch_checkout "${GITHUB_ACTOR}" "${GITHUB_REF_NAME}"
4146
else

0 commit comments

Comments
 (0)