From 6aeaa7c819dc9875d2342307f679262f7074e790 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Mon, 9 Sep 2024 19:49:15 -0500 Subject: [PATCH] ci: prevent mkdocs macro issue (#2056) * (chore): add CI to prevent mkdocs macro issue * bump checkout to v4 --- .github/workflows/mkdocs_bug_prevent.yml | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/mkdocs_bug_prevent.yml diff --git a/.github/workflows/mkdocs_bug_prevent.yml b/.github/workflows/mkdocs_bug_prevent.yml new file mode 100644 index 000000000..3bfcd80db --- /dev/null +++ b/.github/workflows/mkdocs_bug_prevent.yml @@ -0,0 +1,39 @@ +name: Check for Mkdocs Issues + +on: + push: + branches: + - master + pull_request: + +jobs: + triage: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Find JSON Files Changed in Commit + id: find_json_files + run: | + # Get the list of JSON files changed in the commit + JSON_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.json$' || true) + echo "json_files=$JSON_FILES" >> $GITHUB_ENV + + - name: Check JSON Files for MkDocs Macro Issues + run: | + # Check if any JSON files contain the [[ pattern + if [[ -n "$JSON_FILES" ]]; then + if grep -r '\[\[' $JSON_FILES; then + echo "::error::Found '[[', which breaks MkDocs macros in JSON files:" + grep -r -n '\[\[' $JSON_FILES + exit 1 + else + echo "No '[[', patterns found in JSON files." + fi + else + echo "No JSON files changed in this commit." + fi