-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.72 KB
/
Copy pathdocs.yml
File metadata and controls
48 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: docs
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
links:
name: relative links resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2
with:
# Offline: only local file targets and fragments are checked, so the
# job cannot flake on external hosts and makes no network requests.
args: --offline --no-progress --include-fragments --root-dir "${{ github.workspace }}" '**/*.md'
fail: true
encoding:
name: spec bytes are UTF-8 / LF / no BOM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: check
shell: bash
run: |
set -euo pipefail
status=0
while IFS= read -r -d '' f; do
if LC_ALL=C grep -q $'\r' "$f"; then
echo "::error file=$f::contains CRLF line endings (Distribution Protocol §2 requires LF)"; status=1
fi
if [ "$(head -c 3 "$f" | od -An -tx1 | tr -d ' \n')" = "efbbbf" ]; then
echo "::error file=$f::starts with a UTF-8 BOM (Distribution Protocol §2 forbids it)"; status=1
fi
if ! iconv -f UTF-8 -t UTF-8 "$f" >/dev/null 2>&1; then
echo "::error file=$f::is not valid UTF-8"; status=1
fi
if [ -s "$f" ] && [ "$(tail -c 1 "$f" | od -An -tx1 | tr -d ' \n')" != "0a" ]; then
echo "::error file=$f::does not end with a newline"; status=1
fi
done < <(git ls-files -z -- '*.md' LICENSE)
exit "$status"