Skip to content

Commit 5d615c5

Browse files
committed
Fix issue with actions/checkout@v2
In certain workflows we use a custom Docker image for cross-compilation, this image is old and unmaintained so it has an old version of git and the latest version actions/checkout doesn't support it. This causes the action to fallback to the Github API to download the files but that doesn't create a git repository, thus the history is lost but goreleaser needs it to generate the changelog so it fails. So we use git directly to fetch the repository in certain cases to avoid this failures.
1 parent c0802f7 commit 5d615c5

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

.github/workflows/nightly.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ jobs:
2020

2121
steps:
2222
- name: checkout
23-
uses: actions/checkout@v2
23+
env:
24+
GITHUB_USER: ${{ github.actor }}
25+
GITHUB_TOKEN: ${{ github.token }}
26+
27+
# We must call git directly since the actions/checkout@v2 doesn't support the git
28+
# version installed in the crossbuild container, so it uses the GH API to fetch
29+
# the repo but that doesn't create a git repository thus goreleaser fails to
30+
# create the changelog.
31+
run: rm -rf * && git clone https://$GITHUB_USER:[email protected]/${{ github.repository }}.git --single-branch .
2432

2533
- name: build
2634
env:

.github/workflows/release.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
env:
21+
GITHUB_USER: ${{ github.actor }}
22+
GITHUB_TOKEN: ${{ github.token }}
23+
24+
# We must call git directly since the actions/checkout@v2 doesn't support the git
25+
# version installed in the crossbuild container, so it uses the GH API to fetch
26+
# the repo but that doesn't create a git repository thus goreleaser fails to
27+
# create the changelog.
28+
run: |
29+
BRANCH_OR_TAG=$(echo ${{ github.ref }} | awk '{split($0,a,"/"); print a[3]}')
30+
rm -rf * && git clone https://$GITHUB_USER:[email protected]/${{ github.repository }}.git -b $BRANCH_OR_TAG --single-branch .
2131
2232
- name: Build
2333
run: goreleaser

.github/workflows/test.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,17 @@ jobs:
113113

114114
steps:
115115
- name: checkout
116-
uses: actions/checkout@v2
116+
env:
117+
GITHUB_USER: ${{ github.actor }}
118+
GITHUB_TOKEN: ${{ github.token }}
119+
120+
# We must call git directly since the actions/checkout@v2 doesn't support the git
121+
# version installed in the crossbuild container, so it uses the GH API to fetch
122+
# the repo but that doesn't create a git repository thus goreleaser fails to
123+
# create the changelog.
124+
run: |
125+
BRANCH_OR_TAG=$(echo ${{ github.ref }} | awk '{split($0,a,"/"); print a[3]}')
126+
rm -rf * && git clone https://$GITHUB_USER:[email protected]/${{ github.repository }}.git -b $BRANCH_OR_TAG --single-branch .
117127
118128
- name: build
119129
shell: bash

0 commit comments

Comments
 (0)