Skip to content

Commit 2ed9a3f

Browse files
committed
Fix CI bug when multirepo branches don't exist
1 parent 9e3ad2a commit 2ed9a3f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

.github/workflows/test-examples.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ jobs:
4141
if: github.event_name == 'pull_request'
4242
run: |
4343
git remote update
44-
git checkout ${{ github.head_ref }}
45-
if [ $? -eq 0 ]; then
44+
if git checkout ${{ github.head_ref }}; then
4645
echo "Using branch ${{github.head_ref}}"
4746
echo "found-branch=1\n" >> $GITHUB_OUTPUT
4847
else
@@ -56,8 +55,7 @@ jobs:
5655
if: github.event_name == 'pull_request' && steps.check-head-ref == 0
5756
run: |
5857
git remote update
59-
git checkout ${{ github.base_ref }}
60-
if [ $? -eq 0 ]; then
58+
if git checkout ${{ github.base_ref }}; then
6159
echo "Using branch ${{github.base_ref}}"
6260
echo "found-branch=1\n" >> $GITHUB_OUTPUT
6361
else

0 commit comments

Comments
 (0)