Skip to content

Commit

Permalink
Merge pull request #40378 from rushatgabhane/validate-redirect
Browse files Browse the repository at this point in the history
[HelpDot] verify that redirects.csv does not contain any duplicate keys
  • Loading branch information
amyevans authored Apr 17, 2024
2 parents 3ba42e6 + 02a3b82 commit f2fbb9a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/verifyRedirect.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# HelpDot - Verifies that redirects.csv does not have any duplicates
# Duplicate sourceURLs break redirection on cloudflare pages

declare -r REDIRECTS_FILE="docs/redirects.csv"

duplicates=$(awk -F, 'a[$1]++{print $1}' $REDIRECTS_FILE)

if [[ -z "$duplicates" ]]; then
exit 0
fi

echo "duplicate redirects are not allowed: $duplicates"
exit 1
3 changes: 3 additions & 0 deletions .github/workflows/deployExpensifyHelp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:

- name: Create docs routes file
run: ./.github/scripts/createDocsRoutes.sh

- name: Check duplicates in redirect.csv
run: ./.github/scripts/verifyRedirect.sh

- name: Build with Jekyll
uses: actions/jekyll-build-pages@0143c158f4fa0c5dcd99499a5d00859d79f70b0e
Expand Down

0 comments on commit f2fbb9a

Please sign in to comment.