mirror of
https://github.com/dockur/windows.git
synced 2026-04-21 14:01:11 +01:00
Co-authored-by: kroese <5763256+kroese@users.noreply.github.com> Agent-Logs-Url: https://github.com/dockur/windows/sessions/828997f3-2043-4f5a-94df-76321b177c73
80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
on: [workflow_call]
|
|
name: "Check"
|
|
permissions: {}
|
|
|
|
jobs:
|
|
shellcheck:
|
|
name: shellcheck
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v6
|
|
-
|
|
name: Run ShellCheck
|
|
uses: ludeeus/action-shellcheck@master
|
|
env:
|
|
SHELLCHECK_OPTS: -x --source-path=src -e SC1091 -e SC2001 -e SC2002 -e SC2034 -e SC2064 -e SC2153 -e SC2317 -e SC2028
|
|
-
|
|
name: Lint Dockerfile
|
|
uses: hadolint/hadolint-action@v3.3.0
|
|
with:
|
|
dockerfile: Dockerfile
|
|
ignore: DL3006,DL3008
|
|
failure-threshold: warning
|
|
-
|
|
name: Validate XML
|
|
uses: action-pack/valid-xml@v1
|
|
with:
|
|
path: "assets"
|
|
file-endings: ".xml"
|
|
-
|
|
name: Validate JSON and YML files
|
|
uses: GrantBirki/json-yaml-validate@v4
|
|
with:
|
|
yaml_exclude_regex: ".*\\kubernetes\\.yml$"
|
|
-
|
|
name: Validate Links
|
|
run: |
|
|
errors=0
|
|
count=0
|
|
host=""
|
|
declare -A seen
|
|
|
|
check() {
|
|
local url="$1" http
|
|
http=$(curl -sSL -o /dev/null -w "%{http_code}" --max-time 10 -I -- "$url" 2>&1) || http="000"
|
|
[[ "$http" == 2* ]] && return 0
|
|
http=$(curl -sSL -o /dev/null -w "%{http_code}" --max-time 10 -r "0-0" -- "$url" 2>&1) || http="000"
|
|
[[ "$http" == 2* ]]
|
|
}
|
|
|
|
while IFS= read -r line; do
|
|
if [[ "$line" =~ ^[[:space:]]*local[[:space:]]+host=\"(https://[^\"]+)\" ]]; then
|
|
host="${BASH_REMATCH[1]%/}"
|
|
continue
|
|
fi
|
|
[[ "$line" =~ ^[[:space:]]*url=\"(.+)\" ]] || continue
|
|
val="${BASH_REMATCH[1]#/}"
|
|
if [[ "$val" == https://* ]]; then
|
|
url="$val"
|
|
elif [[ -n "$host" ]]; then
|
|
url="$host/$val"
|
|
else
|
|
continue
|
|
fi
|
|
[[ -v seen[$url] ]] && continue
|
|
seen[$url]=1
|
|
count=$((count + 1))
|
|
if check "$url"; then
|
|
echo " OK: $url"
|
|
else
|
|
echo "FAIL: $url"
|
|
errors=$((errors + 1))
|
|
fi
|
|
done < "src/define.sh"
|
|
|
|
echo ""
|
|
printf '%d/%d links valid\n' "$(( count - errors ))" "$count"
|
|
(( errors == 0 ))
|