diff --git a/.github/scripts/enforceVideoFormats.sh b/.github/scripts/enforceVideoFormats.sh new file mode 100755 index 000000000000..fa6a6465c9fa --- /dev/null +++ b/.github/scripts/enforceVideoFormats.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Checks for usage of iframe and non-cloudflare URL for videos in documentation. +# Assumes that Jekyll markdown documents compile and render correctly, i.e. +# no malformed HTML tags or liquid tags. +set -eu + +source ./scripts/shellUtils.sh +title "Enforce no iframe usage for videos and cloudflare CDN links" +HAS_VIOLATION=false + +# Use diff to find all changed markdown files in the docs/ directory compared +# the current HEAD commit on main. This will mirror behavior on the workflow +# when the local copy of origin/main is up-to-date. We exclude the README.md +# files from linting. +CHANGED_FILES="$(git diff origin/main..HEAD --name-only --diff-filter=MAR -- ':docs/*.md' ':(exclude,icase)*README.md')" + +# RegEx to match the opening iframe tags. +# Matches iframes like: