Skip to content

Commit f27702d

Browse files
committed
ci: fix link check for files.nordicsemi.com
Files.nordicsemi.com doesnt allow downloading just header Escape characters on regex expression caused errors Signed-off-by: Thomas Stilwell <[email protected]>
1 parent 2abfe23 commit f27702d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/compliance.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
- name: Check added or updated links
107107
working-directory: ncs/nrf
108108
run: |
109-
RE=".. _\`(.*)\`: (.*)"
109+
RE='.. _`(.*)`: (.*)'
110110
LINKS=$(git diff --unified=0 "${{ github.event.pull_request.base.sha }}..HEAD" -- "doc/nrf/links.txt" | \
111111
grep "^+" || true | \
112112
grep -Ev "^(---|\+\+\+)" || true)
@@ -117,13 +117,18 @@ jobs:
117117
URL=${BASH_REMATCH[2]}
118118
119119
echo -n "Checking URL for '$NAME' ($URL)... "
120-
status=$(curl --write-out "%{http_code}" --output /dev/null --silent --head "$URL" || true)
120+
if [[ "$URL" == *"files.nordicsemi.com"* ]]; then
121+
# files.nordicsemi.com server does not allow downloading only headers
122+
status=$(curl --write-out "%{http_code}" --output /dev/null --silent "$URL" || true)
123+
else
124+
status=$(curl --write-out "%{http_code}" --output /dev/null --silent --head "$URL" || true)
125+
fi
121126
122127
if [[ "$status" -ne 200 ]]; then
123128
echo "FAIL (HTTP code: ${status})"
124-
exit 1
125-
else
126-
echo "OK"
127-
fi
129+
exit 1
130+
else
131+
echo "OK"
132+
fi
128133
fi
129134
done <<< "$LINKS"

0 commit comments

Comments
 (0)