@@ -29,11 +29,19 @@ jobs:
2929
3030 - name : Use local branch
3131 shell : bash
32+ env :
33+ EVENT_NAME : ${{ github.event_name }}
34+ HEAD_REF : ${{ github.head_ref }}
35+ REF_NAME : ${{ github.ref_name }}
3236 run : |
33- BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
34- git branch -D $BRANCH 2>/dev/null || true
35- git branch $BRANCH HEAD
36- git checkout $BRANCH
37+ if [ "$EVENT_NAME" = "pull_request" ]; then
38+ BRANCH="$HEAD_REF"
39+ else
40+ BRANCH="$REF_NAME"
41+ fi
42+ git branch -D "$BRANCH" 2>/dev/null || true
43+ git branch "$BRANCH" HEAD
44+ git checkout "$BRANCH"
3745
3846 - name : Install PHP
3947 uses : shivammathur/setup-php@v2
@@ -60,11 +68,19 @@ jobs:
6068
6169 - name : Use local branch
6270 shell : bash
71+ env :
72+ EVENT_NAME : ${{ github.event_name }}
73+ HEAD_REF : ${{ github.head_ref }}
74+ REF_NAME : ${{ github.ref_name }}
6375 run : |
64- BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
65- git branch -D $BRANCH 2>/dev/null || true
66- git branch $BRANCH HEAD
67- git checkout $BRANCH
76+ if [ "$EVENT_NAME" = "pull_request" ]; then
77+ BRANCH="$HEAD_REF"
78+ else
79+ BRANCH="$REF_NAME"
80+ fi
81+ git branch -D "$BRANCH" 2>/dev/null || true
82+ git branch "$BRANCH" HEAD
83+ git checkout "$BRANCH"
6884
6985 - name : Install PHP
7086 uses : shivammathur/setup-php@v2
@@ -103,11 +119,19 @@ jobs:
103119
104120 - name : Use local branch
105121 shell : bash
122+ env :
123+ EVENT_NAME : ${{ github.event_name }}
124+ HEAD_REF : ${{ github.head_ref }}
125+ REF_NAME : ${{ github.ref_name }}
106126 run : |
107- BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
108- git branch -D $BRANCH 2>/dev/null || true
109- git branch $BRANCH HEAD
110- git checkout $BRANCH
127+ if [ "$EVENT_NAME" = "pull_request" ]; then
128+ BRANCH="$HEAD_REF"
129+ else
130+ BRANCH="$REF_NAME"
131+ fi
132+ git branch -D "$BRANCH" 2>/dev/null || true
133+ git branch "$BRANCH" HEAD
134+ git checkout "$BRANCH"
111135
112136 - name : Install PHP with extensions
113137 uses : shivammathur/setup-php@v2
@@ -153,11 +177,19 @@ jobs:
153177
154178 - name : Use local branch
155179 shell : bash
180+ env :
181+ EVENT_NAME : ${{ github.event_name }}
182+ HEAD_REF : ${{ github.head_ref }}
183+ REF_NAME : ${{ github.ref_name }}
156184 run : |
157- BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
158- git branch -D $BRANCH 2>/dev/null || true
159- git branch $BRANCH HEAD
160- git checkout $BRANCH
185+ if [ "$EVENT_NAME" = "pull_request" ]; then
186+ BRANCH="$HEAD_REF"
187+ else
188+ BRANCH="$REF_NAME"
189+ fi
190+ git branch -D "$BRANCH" 2>/dev/null || true
191+ git branch "$BRANCH" HEAD
192+ git checkout "$BRANCH"
161193
162194 - name : Install PHP with extensions
163195 uses : shivammathur/setup-php@v2
0 commit comments