|
| 1 | +name: Verify Redirects |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "static/_redirects" |
| 7 | + - ".netlify.toml" |
| 8 | + - "hugo.toml" |
| 9 | + - "content/version/3/0/**" |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - fix/use-consistent-casing |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +jobs: |
| 16 | + verify-redirects: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v6 |
| 22 | + |
| 23 | + - name: Setup Hugo |
| 24 | + run: | |
| 25 | + HUGO_VERSION="0.155.0" |
| 26 | + wget -q "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" -O hugo.deb |
| 27 | + sudo dpkg -i hugo.deb |
| 28 | + hugo version |
| 29 | +
|
| 30 | + - name: Build site |
| 31 | + run: hugo --quiet |
| 32 | + |
| 33 | + - name: Verify uppercase file exists |
| 34 | + run: | |
| 35 | + if [ -f "public/version/3/0/code_of_conduct/CODE_OF_CONDUCT.md" ]; then |
| 36 | + echo "✓ CODE_OF_CONDUCT.md exists" |
| 37 | + else |
| 38 | + echo "✗ CODE_OF_CONDUCT.md does NOT exist" |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | +
|
| 42 | + - name: Verify lowercase file does NOT exist (case-sensitive check) |
| 43 | + run: | |
| 44 | + # On Linux (case-sensitive), verify lowercase file does NOT exist |
| 45 | + echo "Files generated by Hugo:" |
| 46 | + ls -la public/version/3/0/code_of_conduct/*.md 2>/dev/null || true |
| 47 | + |
| 48 | + if [ -f "public/version/3/0/code_of_conduct/code_of_conduct.md" ]; then |
| 49 | + echo "✗ code_of_conduct.md exists (should NOT exist)" |
| 50 | + exit 1 |
| 51 | + else |
| 52 | + echo "✓ code_of_conduct.md does NOT exist (correct - redirect will work)" |
| 53 | + fi |
| 54 | + |
| 55 | + # Verify uppercase exists |
| 56 | + if [ -f "public/version/3/0/code_of_conduct/CODE_OF_CONDUCT.md" ]; then |
| 57 | + echo "✓ CODE_OF_CONDUCT.md exists (correct)" |
| 58 | + else |
| 59 | + echo "✗ CODE_OF_CONDUCT.md NOT found" |
| 60 | + exit 1 |
| 61 | + fi |
| 62 | +
|
| 63 | + - name: Verify _redirects file exists |
| 64 | + run: | |
| 65 | + if [ -f "public/_redirects" ]; then |
| 66 | + echo "✓ _redirects file exists" |
| 67 | + cat public/_redirects |
| 68 | + else |
| 69 | + echo "✗ _redirects file does NOT exist" |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | +
|
| 73 | + - name: Verify redirect rule exists |
| 74 | + run: | |
| 75 | + if grep -q "/version/3/0/code_of_conduct/code_of_conduct.md.*CODE_OF_CONDUCT.md" public/_redirects; then |
| 76 | + echo "✓ Redirect rule found in _redirects" |
| 77 | + else |
| 78 | + echo "✗ Redirect rule NOT found in _redirects" |
| 79 | + exit 1 |
| 80 | + fi |
0 commit comments