Skip to content

Commit 2617957

Browse files
committed
build: workaround for an actions/checkout bug
a9a6e9e and ea43df2 removed a step that was probably intended to work around actions/checkout#290 and actions/checkout#882, but broke the CI build if anyone used a lightweight tag (because these fetch lines actually shallow the tag depth to 1). This commit attempts to thread the needle by making this workaround conditional only to releases, where (if the person doing the release has followed the steps correctly), there is guaranteed to be an annotated tag at depth 1 in the tag history. (If I'm parsing the checkout bugs correctly, they only trigger on a tag action anyways.) (cherry picked from commit 8713efd)
1 parent 2861a22 commit 2617957

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
with:
3737
fetch-depth: 0 # all history
3838
submodules: true
39+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
40+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
3941
- name: Build source packages
4042
run: make -j$(nproc) package-source
4143
working-directory: crawl-ref/source
@@ -115,6 +117,9 @@ jobs:
115117
with:
116118
fetch-depth: 0 # all history
117119
submodules: true
120+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
121+
if: github.event.release.tag_name != null
122+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
118123
- name: Set up Python 3.7
119124
uses: actions/setup-python@v4
120125
with:
@@ -186,6 +191,8 @@ jobs:
186191
with:
187192
fetch-depth: 0 # all history
188193
submodules: false
194+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
195+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
189196
- name: Install dependencies
190197
run: ./deps.py --build-opts "${{ matrix.build_opts }}" --appimage
191198
working-directory: .github/workflows
@@ -222,6 +229,8 @@ jobs:
222229
with:
223230
fetch-depth: 0 # all history
224231
submodules: false
232+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
233+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
225234
- name: Install dependencies
226235
run: ./deps.py --build-opts TILES=1 --debian-packages
227236
working-directory: .github/workflows
@@ -292,6 +301,9 @@ jobs:
292301
- uses: actions/checkout@v3
293302
with:
294303
fetch-depth: 0 # all history
304+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
305+
if: github.event.release.tag_name != null
306+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
295307
- name: Checkout submodules
296308
shell: bash
297309
run: |
@@ -338,6 +350,9 @@ jobs:
338350
- uses: actions/checkout@v3
339351
with:
340352
fetch-depth: 0 # all history
353+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
354+
if: github.event.release.tag_name != null
355+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
341356
- name: Checkout submodules (for crosscompile)
342357
shell: bash
343358
run: |
@@ -537,6 +552,9 @@ jobs:
537552
with:
538553
fetch-depth: 0 # all history
539554
submodules: true
555+
- name: Fix tags for release # work around https://github.com/actions/checkout/issues/882
556+
if: github.event.release.tag_name != null
557+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # will break on a lightweight tag
540558
- name: Install dependencies
541559
run: ./deps.py --build-opts "${{ matrix.build_opts }}"
542560
working-directory: .github/workflows

0 commit comments

Comments
 (0)