Skip to content

blogcaption_check

blogcaption_check #191

# Checks blogcaption request objects with jq to make sure they are valid
name: blogcaption_check
on:
#pull_request:
# run once a day
schedule:
- cron: '33 21 * * *'
# 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_blogcaption:
# 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@v3
- name: Check for incorrect blog captions
run: |
busted_files=""
for file in `find site/_posts -name "*.md"`; do
grep 'image.liquid' $file |sed 's/.*alt="//'|sed 's/".*//' > file.out
noperiod=`grep -vc '\.' file.out`
if [ "x$noperiod" != "x0" ]; then
busted_files="$busted_files $file"
fi
done
if [ "x$busted_files" != "x" ] ; then
echo "Files with at least one caption that is not a full sentence."
echo $busted_files
exit 1
fi
shell: bash