Skip to content

Commit ae8ed44

Browse files
committed
ci: avoid gitconfig lock race on shared runner via GIT_CONFIG env vars
1 parent 8a6db08 commit ae8ed44

2 files changed

Lines changed: 42 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
fetch-depth: 0
1717
ref: ${{ github.head_ref }}
1818

19-
- name: Configure and checkout submodules
20-
run: |
21-
git config --global url."https://github.com/".insteadOf "git@github.com:"
22-
git submodule update --init --recursive
19+
- name: Checkout submodules
20+
env:
21+
GIT_CONFIG_COUNT: "1"
22+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
23+
GIT_CONFIG_VALUE_0: git@github.com:
24+
run: git submodule update --init --recursive
2325

2426
- name: Install dependencies
2527
run: bun install --frozen-lockfile
@@ -36,10 +38,12 @@ jobs:
3638
fetch-depth: 0
3739
ref: ${{ github.head_ref }}
3840

39-
- name: Configure and checkout submodules
40-
run: |
41-
git config --global url."https://github.com/".insteadOf "git@github.com:"
42-
git submodule update --init --recursive
41+
- name: Checkout submodules
42+
env:
43+
GIT_CONFIG_COUNT: "1"
44+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
45+
GIT_CONFIG_VALUE_0: git@github.com:
46+
run: git submodule update --init --recursive
4347

4448
- name: Install dependencies
4549
run: bun install --frozen-lockfile
@@ -56,10 +60,12 @@ jobs:
5660
fetch-depth: 0
5761
ref: ${{ github.head_ref }}
5862

59-
- name: Configure and checkout submodules
60-
run: |
61-
git config --global url."https://github.com/".insteadOf "git@github.com:"
62-
git submodule update --init --recursive
63+
- name: Checkout submodules
64+
env:
65+
GIT_CONFIG_COUNT: "1"
66+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
67+
GIT_CONFIG_VALUE_0: git@github.com:
68+
run: git submodule update --init --recursive
6369

6470
- name: Install dependencies
6571
run: bun install --frozen-lockfile
@@ -76,10 +82,12 @@ jobs:
7682
fetch-depth: 0
7783
ref: ${{ github.head_ref }}
7884

79-
- name: Configure and checkout submodules
80-
run: |
81-
git config --global url."https://github.com/".insteadOf "git@github.com:"
82-
git submodule update --init --recursive
85+
- name: Checkout submodules
86+
env:
87+
GIT_CONFIG_COUNT: "1"
88+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
89+
GIT_CONFIG_VALUE_0: git@github.com:
90+
run: git submodule update --init --recursive
8391

8492
- name: Install dependencies
8593
run: bun install --frozen-lockfile
@@ -108,10 +116,12 @@ jobs:
108116
fetch-depth: 0
109117
ref: ${{ github.head_ref }}
110118

111-
- name: Configure and checkout submodules
112-
run: |
113-
git config --global url."https://github.com/".insteadOf "git@github.com:"
114-
git submodule update --init --recursive
119+
- name: Checkout submodules
120+
env:
121+
GIT_CONFIG_COUNT: "1"
122+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
123+
GIT_CONFIG_VALUE_0: git@github.com:
124+
run: git submodule update --init --recursive
115125

116126
- name: Install dependencies
117127
run: bun install --frozen-lockfile
@@ -147,10 +157,12 @@ jobs:
147157
fetch-depth: 0
148158
ref: ${{ github.head_ref }}
149159

150-
- name: Configure and checkout submodules
151-
run: |
152-
git config --global url."https://github.com/".insteadOf "git@github.com:"
153-
git submodule update --init --recursive
160+
- name: Checkout submodules
161+
env:
162+
GIT_CONFIG_COUNT: "1"
163+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
164+
GIT_CONFIG_VALUE_0: git@github.com:
165+
run: git submodule update --init --recursive
154166

155167
- name: Install dependencies
156168
run: bun install --frozen-lockfile

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ jobs:
2121
ref: ${{ github.head_ref }}
2222
token: ${{ secrets.GITHUB_TOKEN }}
2323

24-
- name: Configure and checkout submodules
25-
run: |
26-
# Convert SSH URLs to HTTPS for GitHub Actions
27-
git config --global url."https://github.com/".insteadOf "git@github.com:"
28-
git submodule update --init --recursive
24+
- name: Checkout submodules
25+
env:
26+
GIT_CONFIG_COUNT: "1"
27+
GIT_CONFIG_KEY_0: url.https://github.com/.insteadOf
28+
GIT_CONFIG_VALUE_0: git@github.com:
29+
run: git submodule update --init --recursive
2930

3031
- uses: ./tools/github/setup
3132
with:

0 commit comments

Comments
 (0)