Skip to content

Commit bff93a1

Browse files
authored
dev: fix installation script for curl v8.8.0 (golangci#4814)
1 parent 53eadf2 commit bff93a1

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/post-release.yml

+10
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,13 @@ jobs:
103103
branch-suffix: timestamp
104104
title: "docs: update documentation assets"
105105
delete-branch: true
106+
107+
check-install-script:
108+
name: Installation script (remote)
109+
strategy:
110+
matrix:
111+
os: [ubuntu-latest, macos-latest, windows-latest]
112+
runs-on: ${{ matrix.os }}
113+
114+
steps:
115+
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "./install-golangci-lint"

.github/workflows/pr.yml

+11
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ jobs:
128128
# needed for github-action-config.json generation
129129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130130

131+
check-local-install-script:
132+
name: Installation script (local)
133+
strategy:
134+
matrix:
135+
os: [ubuntu-latest, macos-latest, windows-latest]
136+
runs-on: ${{ matrix.os }}
137+
steps:
138+
- uses: actions/checkout@v4
139+
- name: Check installation script
140+
run: cat ./install.sh | sh -s -- -d -b "./install-golangci-lint"
141+
131142
# Note: the command `run` is tested by the previous steps (`make test`).
132143
commands:
133144
needs: golangci-lint

install.sh

+20
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,26 @@ http_download_curl() {
275275
local_file=$1
276276
source_url=$2
277277
header=$3
278+
279+
# workaround https://github.com/curl/curl/issues/13845
280+
curl_version=$(curl --version | head -n 1 | awk '{ print $2 }')
281+
if [ "$curl_version" = "8.8.0" ]; then
282+
log_debug "http_download_curl curl $curl_version detected"
283+
if [ -z "$header" ]; then
284+
curl -sL -o "$local_file" "$source_url"
285+
else
286+
curl -sL -H "$header" -o "$local_file" "$source_url"
287+
288+
nf=$(cat "$local_file" | jq -r '.error // ""')
289+
if [ ! -z "$nf" ]; then
290+
log_debug "http_download_curl received an error: $nf"
291+
return 1
292+
fi
293+
fi
294+
295+
return 0
296+
fi
297+
278298
if [ -z "$header" ]; then
279299
code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
280300
else

0 commit comments

Comments
 (0)