mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-04-06 07:15:31 -04:00
changed to make only a single call to curl per link
This commit is contained in:
parent
5f1592fa7a
commit
8735757c93
1 changed files with 8 additions and 6 deletions
14
.github/workflows/testPatches.sh
vendored
14
.github/workflows/testPatches.sh
vendored
|
|
@ -22,15 +22,20 @@ for file in "$wikiDirectory"/*.md; do
|
||||||
do
|
do
|
||||||
if [[ $line =~ $patchRE ]]; then
|
if [[ $line =~ $patchRE ]]; then
|
||||||
extractedURL=${BASH_REMATCH[0]}
|
extractedURL=${BASH_REMATCH[0]}
|
||||||
patchAccessResult=$(curl -s -w "%{http_code}" -o /dev/null "$extractedURL")
|
response=$(curl -s -w "%{http_code}" -o - "$extractedURL")
|
||||||
if [ "$patchAccessResult" -ne 200 ]; then
|
|
||||||
|
http_status_code="${response: -3}"
|
||||||
|
patchContent="${response:0:-3}"
|
||||||
|
|
||||||
|
if [ "$http_status_code" -ne 200 ] || [ -z "$patchContent" ]; then
|
||||||
echo "⚠️ - $extractedURL"
|
echo "⚠️ - $extractedURL"
|
||||||
update_line "$line" "inaccessible"
|
update_line "$line" "inaccessible"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git -C "$dwlSrcDirectory" apply --check <(curl -s "$extractedURL") > /dev/null 2>&1
|
git -C "$dwlSrcDirectory" apply --check <<< "$patchContent" > /dev/null 2>&1
|
||||||
patchApplicationExitCode=$?
|
patchApplicationExitCode=$?
|
||||||
|
|
||||||
if [ $patchApplicationExitCode -eq 0 ]; then
|
if [ $patchApplicationExitCode -eq 0 ]; then
|
||||||
echo "✅ - $extractedURL"
|
echo "✅ - $extractedURL"
|
||||||
update_line "$line" "pass"
|
update_line "$line" "pass"
|
||||||
|
|
@ -38,10 +43,7 @@ for file in "$wikiDirectory"/*.md; do
|
||||||
echo "❌ - $extractedURL"
|
echo "❌ - $extractedURL"
|
||||||
update_line "$line" "fail"
|
update_line "$line" "fail"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done < "$file"
|
done < "$file"
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue