|
| 1 | +name: Lint |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + shellcheck: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Run ShellCheck on all scripts |
| 16 | + uses: ludeeus/action-shellcheck@master |
| 17 | + with: |
| 18 | + scandir: scripts |
| 19 | + severity: warning |
| 20 | + |
| 21 | + no-personal-data: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Check for personal paths or data leaks |
| 27 | + run: | |
| 28 | + echo "Scanning for personal data in scripts and docs..." |
| 29 | + FAIL=0 |
| 30 | + # Check for common personal path patterns |
| 31 | + if grep -rn '/mnt/user\|/home/[a-z]' scripts/ docs/ 2>/dev/null; then |
| 32 | + echo "FAIL: Found personal paths in scripts/docs" |
| 33 | + FAIL=1 |
| 34 | + fi |
| 35 | + # Check for hardcoded hostnames |
| 36 | + if grep -rn 'watchtower\|geiserback\|ts\.net' scripts/ docs/ 2>/dev/null; then |
| 37 | + echo "FAIL: Found hardcoded hostnames" |
| 38 | + FAIL=1 |
| 39 | + fi |
| 40 | + # Check for hardcoded sample names (but allow 'your_name' placeholders) |
| 41 | + if grep -rn 'SAMPLE=sergio\|SAMPLE=annais' scripts/ docs/ 2>/dev/null; then |
| 42 | + echo "FAIL: Found hardcoded sample names" |
| 43 | + FAIL=1 |
| 44 | + fi |
| 45 | + if [ "$FAIL" -eq 1 ]; then |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | + echo "OK: No personal data found" |
| 49 | +
|
| 50 | + markdown-links: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: Check for broken internal links |
| 56 | + run: | |
| 57 | + echo "Checking internal markdown links..." |
| 58 | + FAIL=0 |
| 59 | + # Extract markdown links and check if target files exist |
| 60 | + for md in docs/*.md README.md; do |
| 61 | + grep -oP '\[.*?\]\(((?!http)[^)]+)\)' "$md" 2>/dev/null | \ |
| 62 | + grep -oP '\(([^)]+)\)' | tr -d '()' | while read -r link; do |
| 63 | + # Handle anchors |
| 64 | + file=$(echo "$link" | cut -d'#' -f1) |
| 65 | + if [ -n "$file" ]; then |
| 66 | + # Resolve relative to the markdown file's directory |
| 67 | + dir=$(dirname "$md") |
| 68 | + target="${dir}/${file}" |
| 69 | + if [ ! -f "$target" ]; then |
| 70 | + echo "BROKEN: ${md} -> ${link} (file not found: ${target})" |
| 71 | + echo "1" > /tmp/link_fail |
| 72 | + fi |
| 73 | + fi |
| 74 | + done |
| 75 | + done |
| 76 | + if [ -f /tmp/link_fail ]; then |
| 77 | + exit 1 |
| 78 | + fi |
| 79 | + echo "OK: All internal links valid" |
0 commit comments