Skip to content

Commit 194cb69

Browse files
committed
GH scripts: add -f to curl
to catch 4xx HTTP errors (curls returns 0 otherwise)
1 parent a10bc18 commit 194cb69

File tree

10 files changed

+24
-15
lines changed

10 files changed

+24
-15
lines changed

.github/scripts/create_continuous_release.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ dir=$(dirname "$0")
99
. "$dir/json-common.sh"
1010

1111
sudo apt install jq
12-
URL=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/continuous" | jq -r '.url')
12+
URL=$(curl -Sf -H "Authorization: token $GITHUB_TOKEN" -X GET\
13+
"https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/continuous" |
14+
jq -r '.url')
1315
if [ "$URL" != null ]; then # release exists
1416
exit 0
1517
fi

.github/scripts/create_release.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ REPL_NL=':a;N;$!ba;s/\n/\\n/g'
2121
markdown_replaces='s/\\_/\\\\_/g;s/\\\*/\\\\*/g' # escape MD escape sequences
2222

2323
sudo apt install jq
24-
URL=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG" | jq -r '.url')
24+
URL=$(curl -Sf -H "Authorization: token $GITHUB_TOKEN" -X GET\
25+
"https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG" |
26+
jq -r '.url')
2527
REQ=PATCH
2628
if [ "$URL" = null ]; then # release doesn't yet exist
2729
REQ=POST

.github/scripts/delete-asset.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ n=-1; while n=$((n + 1)); [ "$n" -lt "$LEN" ]; do
2020
fi
2121
ID=$(jq ".[$n].id" "$JSON")
2222
JSON2=$(mktemp)
23-
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X DELETE \
23+
STATUS=$(curl -Sf -H "Authorization: token $GITHUB_TOKEN" -X DELETE \
2424
"https://api.github.com/repos/$GITHUB_REPOSITORY/releases/assets/$ID" \
2525
-w '%{http_code}' -o "$JSON2")
2626
check_errors "$JSON2"

.github/scripts/download-gh-asset.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ if [ -n "${GITHUB_TOKEN-}" ]; then
2828
else
2929
set --
3030
fi
31-
curl -sSL "$@" "$gh_path" -o "$file"
31+
curl -LSfs "$@" "$gh_path" -o "$file"
3232

.github/scripts/environment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ set_ximea_url() {
136136
# ignore GUID 35adfeed-8e15-4b4d-8364-bd5a65cba5c4 because it is
137137
# ARM (LTS) with pattern Linux_SP.tgz and since it listed first,
138138
# it will be downloaded for x86, ARM beta is OK
139-
ximea_path=$(curl https://www.ximea.com/software-downloads |
139+
ximea_path=$(curl -f https://www.ximea.com/software-downloads |
140140
grep -v 35adfeed-8e15-4b4d-8364-bd5a65cba5c4 |
141141
sed -n "/$ximea_pattern/"\
142142
' { s-^.*\(/getattachment[^"]*\).*$-\1-; p; q; }')

.github/scripts/get-etag.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ output=$1
66
url=$2
77
optional=${3-}
88

9-
ETAG=$(curl -LI "$url" | grep -i '^etag' | sed 's/.*"\(.*\)".*/\1/')
9+
ETAG=$(curl -ILf "$url" | grep -i '^etag' | sed 's/.*"\(.*\)".*/\1/')
1010
if [ "$ETAG" ]; then
1111
printf '%s=' "$output"
1212
printf '%s\n' "$ETAG" | sed 's/[^-._A-Za-z0-9]/_/g'

.github/scripts/install-common-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ install_aja() {(
6363

6464
install_ews() {
6565
sudo mkdir -p /usr/local/include
66-
sudo curl -LS https://raw.githubusercontent.com/hellerf/\
66+
sudo curl -LSf https://raw.githubusercontent.com/hellerf/\
6767
EmbeddableWebServer/master/EmbeddableWebServer.h -o \
6868
/usr/local/include/EmbeddableWebServer.h
6969
}

.github/scripts/macOS/install_others.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
install_ximea() {(
2020
installer=/private/var/tmp/XIMEA_OSX_SP.dmg
2121
if [ ! -f $installer ]; then
22-
curl -S -L "$XIMEA_DOWNLOAD_URL" -o $installer
22+
curl -Sf -L "$XIMEA_DOWNLOAD_URL" -o $installer
2323
fi
2424
hdiutil mount $installer
2525
sudo cp -a /Volumes/XIMEA/m3api.framework \

.github/scripts/upload-asset.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ JSON=$(fetch_json\
1616
UPLOAD_URL=$(jq -r .upload_url "$JSON" | sed "s/{.*}//")
1717

1818
JSON=$(mktemp)
19-
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -H\
19+
STATUS=$(curl -Sf -H "Authorization: token $GITHUB_TOKEN" -H\
2020
"Content-Type: $CONTENT_TYPE" -X POST "$UPLOAD_URL?name=$FILENAME&label=$LABEL"\
2121
-T "$FILE" -w '%{http_code}' -o "$JSON")
2222
check_errors "$JSON"

.github/workflows/ccpp.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ jobs:
7373
key: cache-ndi-${{ runner.os }}-${{ steps.etags.outputs.ndi }}
7474
- name: Download NDI
7575
if: steps.cache-ndi.outputs.cache-hit != 'true'
76-
run: curl -L https://downloads.ndi.tv/SDK/NDI_SDK_Linux/Install_NDI_SDK_v6_Linux.tar.gz -o /var/tmp/Install_NDI_SDK_Linux.tar.gz
76+
run: "curl -Lf https://downloads.ndi.tv/SDK/NDI_SDK_Linux/\
77+
Install_NDI_SDK_v6_Linux.tar.gz -o /var/tmp/Install_NDI_SDK_Linux.tar.gz"
7778
- name: bootstrap
7879
run: |
7980
. .github/scripts/environment.sh
@@ -107,7 +108,9 @@ jobs:
107108
mkdir aitest-context # empty build context
108109
docker build -f .github/scripts/Linux/utils/Dockerfile.ubuntu -t aitest-ubuntu aitest-context
109110
docker build -f .github/scripts/Linux/utils/Dockerfile.arch -t aitest-arch aitest-context
110-
curl -LS -O https://raw.githubusercontent.com/AppImage/pkg2appimage/master/appdir-lint.sh -O https://raw.githubusercontent.com/probonopd/AppImages/master/excludelist
111+
curl -LSf -O https://raw.githubusercontent.com/AppImage/pkg2appimage/\
112+
master/appdir-lint.sh -O https://raw.githubusercontent.com/probonopd/\
113+
AppImages/master/excludelist
111114
sudo apt install desktop-file-utils libfile-mimeinfo-perl # desktop-file-validate, mimetype
112115
./UltraGrid-$VERSION-x86_64.AppImage --appimage-extract
113116
docker run --rm -v $PWD/squashfs-root/:/AppImage aitest-ubuntu /AppImage/AppRun -v
@@ -181,7 +184,7 @@ jobs:
181184
key: cache-ximea-${{ matrix.os }}-${{ steps.etags.outputs.ximea }}
182185
- name: Download XIMEA
183186
if: steps.cache-macos-ximea.outputs.cache-hit != 'true'
184-
run: curl -S -L "$XIMEA_DOWNLOAD_URL" -o /private/var/tmp/XIMEA_OSX_SP.dmg
187+
run: curl -LSf "$XIMEA_DOWNLOAD_URL" -o /private/var/tmp/XIMEA_OSX_SP.dmg
185188
- name: Run actions/cache for NDI
186189
id: cache-ndi
187190
uses: actions/cache@main
@@ -190,7 +193,8 @@ jobs:
190193
key: cache-ndi-${{ runner.os }}-${{ steps.etags.outputs.ndi }}
191194
- name: Download NDI
192195
if: steps.cache-ndi.outputs.cache-hit != 'true'
193-
run: curl -L https://downloads.ndi.tv/SDK/NDI_SDK_Mac/Install_NDI_SDK_v6_Apple.pkg -o /private/var/tmp/Install_NDI_SDK_Apple.pkg
196+
run: "curl -Lf https://downloads.ndi.tv/SDK/NDI_SDK_Mac/Install_\
197+
NDI_SDK_v6_Apple.pkg -o /private/var/tmp/Install_NDI_SDK_Apple.pkg"
194198
- name: bootstrap
195199
run: .github/scripts/macOS/prepare.sh
196200
- name: configure
@@ -265,7 +269,8 @@ jobs:
265269
key: cache-ndi-${{ runner.os }}-${{ steps.etags.outputs.ndi }}
266270
- name: Download NDI
267271
if: steps.cache-ndi.outputs.cache-hit != 'true'
268-
run: curl 'https://downloads.ndi.tv/SDK/NDI_SDK/NDI%206%20SDK.exe' -o 'C:\ndi.exe'
272+
run: curl -f 'https://downloads.ndi.tv/SDK/NDI_SDK/NDI%206%20SDK.exe'
273+
-o 'C:\ndi.exe'
269274
- name: Cache XIMEA
270275
id: cache-macos-ximea
271276
uses: actions/cache@main
@@ -274,7 +279,7 @@ jobs:
274279
key: cache-ximea-${{ runner.os }}-${{ steps.etags.outputs.ximea }}
275280
- name: Download XIMEA
276281
if: steps.cache-macos-ximea.outputs.cache-hit != 'true'
277-
run: curl "$XIMEA_DOWNLOAD_URL" -o 'C:\XIMEA_API_Installer.exe'
282+
run: curl -f "$XIMEA_DOWNLOAD_URL" -o 'C:\XIMEA_API_Installer.exe'
278283

279284
- name: Run actions/cache for libajantv2 build
280285
id: cache-aja

0 commit comments

Comments
 (0)