-
Notifications
You must be signed in to change notification settings - Fork 8.7k
52 lines (47 loc) · 1.55 KB
/
Copy pathvalidate-site.yml
File metadata and controls
52 lines (47 loc) · 1.55 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
49
50
51
52
name: CI · Validate site
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
if: github.repository == 'fineanmol/Hacktoberfest2025'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check core site files
run: |
set -euo pipefail
for f in index.html .nojekyll; do
test -f "$f" || { echo "Missing required file: $f"; exit 1; }
done
echo "Core site files present."
- name: Validate HTML structure
run: |
set -euo pipefail
npx --yes html-validate index.html
echo "HTML validation passed."
- name: Validate contributor JS syntax (changed files only)
run: |
set -euo pipefail
git fetch origin "${{ github.event.pull_request.base.ref }}"
mapfile -t FILES < <(
git diff --name-only "origin/${{ github.event.pull_request.base.ref }}...HEAD" \
| grep -E '^contributors/.*\.js$' || true
)
if [ "${#FILES[@]}" -eq 0 ]; then
echo "No contributor JS changes — skip syntax check."
exit 0
fi
node --check "${FILES[@]}"
for f in "${FILES[@]}"; do
if grep -q 'https:github.com' "$f"; then
echo "Malformed GitHub URL in $f (use https://github.com/ with double slash)"
exit 1
fi
done
echo "Contributor URLs look OK."