Skip to content

chore(repo-sentinel): normalize pre-commit config line endings #14

chore(repo-sentinel): normalize pre-commit config line endings

chore(repo-sentinel): normalize pre-commit config line endings #14

Workflow file for this run

---
name: Markdown Validation
'on':
push:
paths:
- "README.md"
- "TryHackMe/**/*.md"
- "TryHackMe/_meta/TAGS.md"
- "notes/**/*.md"
- "schemas/**/*.json"
- "scripts/check_markdown.py"
- "scripts/render_readme_snapshot.py"
- "scripts/render_tags_doc.py"
- "scripts/generate_markdownlint_debt.py"
- "scripts/run_markdownlint.py"
- "requirements-lint.txt"
- ".markdownlint-cli2.jsonc"
- ".markdownlint-cli2-debt.jsonc"
- ".pre-commit-config.yaml"
- ".github/workflows/markdown-lint.yml"
- ".github/workflows/markdownlint-debt.yml"
pull_request:
paths:
- "README.md"
- "TryHackMe/**/*.md"
- "TryHackMe/_meta/TAGS.md"
- "notes/**/*.md"
- "schemas/**/*.json"
- "scripts/check_markdown.py"
- "scripts/render_readme_snapshot.py"
- "scripts/render_tags_doc.py"
- "scripts/generate_markdownlint_debt.py"
- "scripts/run_markdownlint.py"
- "requirements-lint.txt"
- ".markdownlint-cli2.jsonc"
- ".markdownlint-cli2-debt.jsonc"
- ".pre-commit-config.yaml"
- ".github/workflows/markdown-lint.yml"
- ".github/workflows/markdownlint-debt.yml"
jobs:
note-validation:
name: Taxonomy and Front Matter
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install lint dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-lint.txt
- name: Verify TAGS.md is in sync with taxonomy.json
run: python scripts/render_tags_doc.py --check
- name: Verify README.md snapshot is in sync with tracked notes
run: python scripts/render_readme_snapshot.py --check
- name: Run Markdown checks
run: python scripts/check_markdown.py
markdownlint-changed:
name: Markdownlint Changed Active Notes
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Collect changed active-note Markdown files
id: changed-md
shell: bash
run: |
set -euo pipefail
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
base_ref="${{ github.base_ref }}"
git fetch --no-tags --prune --depth=1 origin "${base_ref}"
diff_range="origin/${base_ref}...HEAD"
elif [[
"${{ github.event.before }}" !=
"0000000000000000000000000000000000000000"
]]; then
diff_range="${{ github.event.before }}...${{ github.sha }}"
else
diff_range=""
fi
if [[ -n "${diff_range}" ]]; then
mapfile -t files < <(
git diff --name-only --diff-filter=ACMR "${diff_range}" |
grep -E '^(TryHackMe|notes)/.*\.md$' |
grep -Ev '^TryHackMe/_meta/' || true
)
else
mapfile -t files < <(
git show --pretty='' --name-only "${{ github.sha }}" |
grep -E '^(TryHackMe|notes)/.*\.md$' |
grep -Ev '^TryHackMe/_meta/' || true
)
fi
echo "count=${#files[@]}" >> "${GITHUB_OUTPUT}"
{
echo "files<<EOF"
printf '%s\n' "${files[@]}"
echo "EOF"
} >> "${GITHUB_OUTPUT}"
- name: Run markdownlint on changed active-note Markdown files
if: steps.changed-md.outputs.count != '0'
shell: bash
run: |
set -euo pipefail
mapfile -t files <<'EOF'
${{ steps.changed-md.outputs.files }}
EOF
python scripts/run_markdownlint.py "${files[@]}"
- name: Skip markdownlint when no active-note Markdown changed
if: steps.changed-md.outputs.count == '0'
run: |
echo "No changed active-note Markdown files;"
echo "skipping markdownlint."