meldestelle/.github/workflows/ci-docs.yml

90 lines
2.5 KiB
YAML

name: CI Docs
on:
pull_request:
paths:
- 'docs/**'
- '.junie/**'
- '.github/workflows/ci-docs.yml'
- '.markdownlint.yaml'
- '.vale.ini'
push:
branches: [ main ]
paths:
- 'docs/**'
- '.junie/**'
- '.github/workflows/ci-docs.yml'
- '.markdownlint.yaml'
- '.vale.ini'
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node (markdownlint)
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install markdownlint
run: npm i -g markdownlint-cli
- name: Markdownlint
run: markdownlint 'docs/**/*.md'
- name: Setup Vale
run: |
curl -fsSL https://install.goreleaser.com/github.com/errata-ai/vale.sh | sh
sudo mv bin/vale /usr/local/bin/vale
- name: Vale
run: vale docs/
- name: Link Checker
uses: lycheeverse/lychee-action@v1
with:
args: --verbose --no-progress 'docs/**/*.md'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Front-Matter Schema Validate
run: |
pip install pyyaml jsonschema
python .junie/scripts/validate-frontmatter.py
- name: Docs Drift Check
run: bash .junie/scripts/check-docs-drift.sh
- name: Render PlantUML
run: bash .junie/scripts/render-plantuml.sh
- name: Upload diagrams artifact
uses: actions/upload-artifact@v4
with:
name: diagrams
path: build/diagrams
- name: Validate YouTrack issues exist (optional)
if: ${{ env.YT_URL != '' && env.YT_TOKEN != '' }}
run: |
set -euo pipefail
KEYS=$(grep -Rho "[A-Z]\+-[0-9]\+" docs | sort -u || true)
if [ -z "$KEYS" ]; then
echo "No YouTrack keys found in docs."
exit 0
fi
echo "Prüfe Keys:" $KEYS
fail=0
for k in $KEYS; do
code=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $YT_TOKEN" \
-H "Accept: application/json" \
"$YT_URL/api/issues/$k?fields=idReadable")
if [ "$code" != "200" ]; then
echo "[YT] Issue nicht gefunden: $k (HTTP $code)"; fail=1;
fi
done
exit $fail
env:
YT_URL: ${{ secrets.YT_URL }}
YT_TOKEN: ${{ secrets.YT_TOKEN }}