Skip to content

Commit decc6d0

Browse files
authored
Merge pull request ARMmbed#15270 from 0xc0170/fix-test-github-action-git-failure
Github actions: use safe.directory for actions invoking git
2 parents 47a32a0 + ad15f0a commit decc6d0

9 files changed

+32
-26
lines changed

.github/workflows/basic_checks.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ jobs:
1717

1818
steps:
1919
- name: Checkout repo
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121
with:
2222
fetch-depth: 0
23+
2324

2425
-
2526
name: install dependencies
@@ -32,7 +33,7 @@ jobs:
3233
run: |
3334
set -x
3435
mkdir -p SCANCODE
35-
36+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
3637
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
3738
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true )
3839
echo $?
@@ -60,13 +61,14 @@ jobs:
6061

6162
steps:
6263
- name: Checkout repo
63-
uses: actions/checkout@v2
64+
uses: actions/checkout@v3
6465
with:
6566
fetch-depth: 0
6667

6768
-
6869
name: include check
6970
run: |
71+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
7072
# checks mbed.h is not included in MbedOS files except in tests
7173
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
7274
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
@@ -81,13 +83,14 @@ jobs:
8183
steps:
8284

8385
- name: Checkout repo
84-
uses: actions/checkout@v2
86+
uses: actions/checkout@v3
8587
with:
8688
fetch-depth: 0
8789

8890
-
8991
name: UTF-8 Check
9092
run: |
93+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
9194
# Make sure we're not introducing any text which is not UTF-8 encoded
9295
git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' )
9396
@@ -96,6 +99,7 @@ jobs:
9699
name: astyle checks
97100
run: |
98101
set -x
102+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
99103
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
100104
| ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
101105
| ( grep -v -f .codecheckignore || true ) \
@@ -111,7 +115,7 @@ jobs:
111115
steps:
112116

113117
- name: Checkout repo
114-
uses: actions/checkout@v2
118+
uses: actions/checkout@v3
115119
with:
116120
fetch-depth: 0
117121

@@ -155,7 +159,7 @@ jobs:
155159
steps:
156160
-
157161
name: Checkout repo
158-
uses: actions/checkout@v2
162+
uses: actions/checkout@v3
159163

160164

161165
- uses: actions/setup-python@v2
@@ -184,14 +188,15 @@ jobs:
184188
steps:
185189
-
186190
name: Checkout repo
187-
uses: actions/checkout@v2
191+
uses: actions/checkout@v3
188192
with:
189193
fetch-depth: 0
190194

191195
-
192196
name: validate pins
193197
run: |
194198
set -x
199+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
195200
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
196201
| ( grep '.*[\\|\/]PinNames.h$' || true ) \
197202
| while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done
@@ -210,7 +215,7 @@ jobs:
210215
steps:
211216
-
212217
name: Checkout repo
213-
uses: actions/checkout@v2
218+
uses: actions/checkout@v3
214219

215220
-
216221
name: cmake build
@@ -237,14 +242,15 @@ jobs:
237242
steps:
238243
-
239244
name: Checkout repo
240-
uses: actions/checkout@v2
245+
uses: actions/checkout@v3
241246
with:
242247
fetch-depth: 0
243248

244249
-
245250
name: frozen tool check
246251
run: |
247252
set -x
253+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
248254
git diff --name-only origin/${GITHUB_BASE_REF} \
249255
| egrep \
250256
-e "^tools/build_api*" \

.github/workflows/docker_management.branch.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
-
3737
name: Checkout
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
3939
with:
4040
fetch-depth: 0
4141

@@ -117,7 +117,7 @@ jobs:
117117

118118
-
119119
name: Checkout
120-
uses: actions/checkout@v2
120+
uses: actions/checkout@v3
121121

122122
-
123123
name: Build docker containers
@@ -164,7 +164,7 @@ jobs:
164164
165165
-
166166
name: Checkout
167-
uses: actions/checkout@v2
167+
uses: actions/checkout@v3
168168

169169
-
170170
name: Find DEV DOCKER DIGEST
@@ -178,7 +178,7 @@ jobs:
178178
# development branch of blinky
179179
-
180180
name: Checkout
181-
uses: actions/checkout@v2
181+
uses: actions/checkout@v3
182182
with:
183183
repository: ARMmbed/mbed-os-example-blinky
184184
path: mbed-os-example-blinky

.github/workflows/docker_management.prune.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
-
1515
name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
-
1919
name: Delete old temporary images
@@ -22,4 +22,4 @@ jobs:
2222
# deletion if only one image exists or if DOCKER_MANAGEMENT_TOKEN is not
2323
# setup. This shouldn't create any alarm as temporary image deletion is
2424
# not a critical activity.
25-
python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ github.repository_owner }} -p ${{ secrets.DOCKER_MANAGEMENT_TOKEN }} delete-old-images -r mbed-os-env-tmp || true
25+
python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ github.repository_owner }} -p ${{ secrets.DOCKER_MANAGEMENT_TOKEN }} delete-old-images -r mbed-os-env-tmp || true

.github/workflows/docker_management.release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
-
2626
name: Checkout
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2828
with:
2929
fetch-depth: 0
3030

@@ -134,7 +134,7 @@ jobs:
134134

135135
-
136136
name: Checkout
137-
uses: actions/checkout@v2
137+
uses: actions/checkout@v3
138138
with:
139139
ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }}
140140

@@ -198,7 +198,7 @@ jobs:
198198
# development branch of blinky
199199
-
200200
name: Checkout example blinky
201-
uses: actions/checkout@v2
201+
uses: actions/checkout@v3
202202
with:
203203
repository: ARMmbed/mbed-os-example-blinky
204204
path: mbed-os-example-blinky
@@ -224,7 +224,7 @@ jobs:
224224
225225
-
226226
name: Checkout
227-
uses: actions/checkout@v2
227+
uses: actions/checkout@v3
228228
with:
229229
ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }}
230230
path: mbed-os-example-blinky/mbed-os

.github/workflows/docker_management.test-PR.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# for PR tests, development branch of blinky is used
3535
-
3636
name: Checkout
37-
uses: actions/checkout@v2
37+
uses: actions/checkout@v3
3838
with:
3939
repository: ARMmbed/mbed-os-example-blinky
4040
path: mbed-os-example-blinky
@@ -49,7 +49,7 @@ jobs:
4949
5050
-
5151
name: Checkout
52-
uses: actions/checkout@v2
52+
uses: actions/checkout@v3
5353
with:
5454
path: mbed-os-example-blinky/mbed-os
5555

.github/workflows/greentea_cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
container: ghcr.io/armmbed/mbed-os-env:master-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v3
1212

1313
- name: Install the latest mbed-tools
1414
run: |

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88

99
steps:
1010
- name: Checkout repo
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v3
1212

1313
- name: Install Python environment
1414
uses: actions/setup-python@v2
1515
with:
1616
python-version: 3.8
1717

1818
- name: Checkout mbed-os-scripts repo (This repo is currently private)
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020
with:
2121
repository: ARMmbed/mbed-os-ci-scripts
2222
token: ${{ secrets.ISSUE_TRIAGING_PERMS }}

.github/workflows/run_conditional_ble_feature_compilation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
container: mbedos/mbed-os-env:latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
with:
1616
path: mbed-os
1717

.github/workflows/test_building_multiple_executables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
container: ghcr.io/armmbed/mbed-os-env:master-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v3
1212

1313
- name: Build the multiple_executables example
1414
run: |

0 commit comments

Comments
 (0)