Merge branch '511-final-review' into stage #22369
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'URL Checker' | |
on: [push, pull_request] | |
jobs: | |
check_urls: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v2.3.4 | |
- name: Download and install Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.82.0" | |
extended: true | |
- name: Update link shortcode to error on broken links | |
run: sed -i 's/#ERROR/\<{{ errorf "broken link in %s" .Position }}\>/g' themes/netDocs/layouts/shortcodes/link.html | |
- name: Run Hugo | |
run: hugo | |
# There is a bug in the checkout module. If the output of this is too long (without head) it will cause the checkout "cleanup" | |
# step to fail. This will cause the action to declare a build failure. | |
- name: Grep for bad kb_links | |
run: | | |
echo "GREP_OUTPUT<<EOF" >> $GITHUB_ENV | |
grep -ro --exclude='*/pdf/index.html' --exclude="*.txt" --include='*.html' '<code><a rel="canonical" href="' public/ | head -20 >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Print bad kb_links | |
run: echo $GREP_OUTPUT | |
- name: Exit != 0 if there was grep output | |
run: exit $(echo -n $GREP_OUTPUT | wc -m) |