Skip to content

content_check

content_check #870

Workflow file for this run

# Checks content for rules. Focused on new astro site
name: content_check
on:
pull_request:
# run once a day
schedule:
- cron: '13 19 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check_content:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Check for blog posts that have incorrect categories
run: |
find astro/src/content/blog/ -type f -name "*.md*" |grep -v swp | xargs grep '^categories:'|sed 's/.*categories: //'|sed 's/, /\n/g'|sort -u > out
RES=`diff out config/contentcheck/known-blog-categories.txt`
exit $RES
shell: bash
- name: Grep for absolute URLs referencing FusionAuth.io
continue-on-error: true
# we ignore 'open your browser and navigate to https://fusionauth.io/docs' because it is part of command output
# we ignore 'homepage "https://fusionauth.io"' because it is part of the homebrew formula
# we ignore "<a href='https://fusionauth.io/docs/v1/tech/tutorials/'>Learn how this app works.</a>" because it is part of a react tutorial
# we use continue-on-error because grep -v exits with code 1 if it doesn't find anything, but that's what we want.
run: |
find astro/src/content/ -type f -name "*.md*" | xargs grep 'https://fusionauth.io' | grep -v 'homepage "https://fusion' | grep -v 'open your browser and navigate to https://fusionauth.io/docs' |grep -v "<a href='https://fusionauth.io/docs/'>Learn how this app works.</a>" > absolute.out
shell: bash
- name: Check for absolute URLs referencing FusionAuth.io from file. Keep this next to 'Grep for absolute URLs referencing FusionAuth.io'
run: |
cat absolute.out
exit `cat absolute.out | wc -l | sed 's/[ ]*//g'`
shell: bash
- name: Check for old asciidoc styling syntax
run: |
exit `find astro/src/content/docs/ -type f | xargs grep ']#'| wc -l |sed 's/[ ]*//g'`
shell: bash
- name: Check for old asciidoc code import
run: |
exit `find astro/src/content/docs/ -type f | xargs grep '++++'| wc -l |sed 's/[ ]*//g'`
shell: bash
- name: Check for old doc nav url references
run: |
exit `find astro/src/content/ -type f | xargs grep 'docs/v1/tech'| wc -l |sed 's/[ ]*//g'`
shell: bash
- name: Check for erroneous markdown references
run: |
exit `find astro/src/content/ -type f -name "*.md*" | xargs grep ']()'| wc -l |sed 's/[ ]*//g'`
shell: bash
- name: Make sure all docs have a full sentence in their description.
run: |
exit `find astro/src/content/docs/ -type f -print|grep -v '/_' |xargs grep '^description: '|grep -v '\.$'|wc -l |sed 's/[ ]*//g'`
shell: bash
- name: Make sure docs don't use old asciidoc icon references
run: |
exit `find astro/src/content/docs/ -type f -print|xargs grep -l 'icon:[a-z]'| wc -l |sed 's/[ ]*//g'`
shell: bash
- name: check for APIFields with no name
run: |
echo `grep -R \<APIField astro/src/content/docs | grep -v name`
exit `find astro/src/content/docs/ -type f -print|xargs grep \<APIField | grep -v name | wc -l | sed 's/[ ]*//g'`
shell: bash
- name: check for old style asciidoc URLs
run: |
echo `grep -R 'https://[^[]*\[' astro/src/content/docs |grep -v '(' | grep -v '[200]'`
exit `find astro/src/content/docs/ -type f -print|xargs grep 'https://[^[]*\[' astro/src/content/docs |grep -v '(' |grep -v '[200]' | wc -l | sed 's/[ ]*//g'`
# ignore the '[200]' because that is a valid case that grep picks up incorrectly
shell: bash
- name: check unsorted vale keywords. error to fix because this decreases merge conflicts
run: |
# first line shows output of unsorted item, second just an exit code. this needs to be LC_ALL=C because otherwise you run into issues between how macos sorts it and how linux/GH actions sorts it
echo `LC_ALL=C sort -cu config/vale/styles/config/vocabularies/FusionAuth/accept.txt`
exit `LC_ALL=C sort -Cu config/vale/styles/config/vocabularies/FusionAuth/accept.txt`
shell: bash