Skip to content

Commit 5d57247

Browse files
committed
ci: add post-deploy URL check for all languages
1 parent 5709ca5 commit 5d57247

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,62 @@ jobs:
3838
environment:
3939
name: github-pages
4040
url: ${{ steps.deployment.outputs.page_url }}
41+
outputs:
42+
page_url: ${{ steps.deployment.outputs.page_url }}
4143
steps:
4244
- id: deployment
4345
uses: actions/deploy-pages@v4
46+
47+
test:
48+
needs: deploy
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Wait for site availability
54+
run: |
55+
BASE_URL="${{ needs.deploy.outputs.page_url }}"
56+
for i in $(seq 1 30); do
57+
curl -sf -o /dev/null "$BASE_URL" && break
58+
sleep 2
59+
done
60+
61+
- name: Check all page URLs
62+
run: |
63+
BASE_URL="${{ needs.deploy.outputs.page_url }}"
64+
BASE_URL="${BASE_URL%/}"
65+
URLS_FILE=$(mktemp)
66+
67+
# English pages (exclude es/hu subdirs)
68+
find docs -name '*.md' -not -path 'docs/es/*' -not -path 'docs/hu/*' | sort | while IFS= read -r f; do
69+
rel="${f#docs/}"; rel="${rel%.md}"
70+
if [ "$rel" = "index" ]; then echo "$BASE_URL/"; else echo "$BASE_URL/$rel/"; fi
71+
done >> "$URLS_FILE"
72+
73+
# ES and HU pages
74+
for lang in es hu; do
75+
[ -d "docs/$lang" ] || continue
76+
find "docs/$lang" -name '*.md' | sort | while IFS= read -r f; do
77+
rel="${f#docs/$lang/}"; rel="${rel%.md}"
78+
if [ "$rel" = "index" ]; then echo "$BASE_URL/$lang/"; else echo "$BASE_URL/$lang/$rel/"; fi
79+
done >> "$URLS_FILE"
80+
done
81+
82+
TOTAL=$(wc -l < "$URLS_FILE")
83+
echo "Checking $TOTAL URLs..."
84+
FAILED=0
85+
86+
while IFS= read -r url; do
87+
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" "$url" || true)
88+
if [ "$STATUS" != "200" ]; then
89+
echo "FAIL [$STATUS]: $url"
90+
FAILED=$((FAILED + 1))
91+
else
92+
echo " OK: $url"
93+
fi
94+
done < "$URLS_FILE"
95+
96+
rm -f "$URLS_FILE"
97+
echo ""
98+
echo "Checked: $TOTAL | Failed: $FAILED"
99+
[ "$FAILED" -eq 0 ]

0 commit comments

Comments
 (0)