mirror of
https://github.com/logos-co/logos-lips.git
synced 2026-08-27 08:11:12 +00:00
Scoped markdown-lint workflow to PR-changed Markdown targets. Adds target handling so metadata/generated-output validation runs against changed docs, while markdownlint/remark continue linting only non-raw changed Markdown files. This PR was made with help from Codex
86 lines
2.3 KiB
YAML
86 lines
2.3 KiB
YAML
name: markdown-linting
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Validate Metadata And Markdown Lint
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
BASE="${{ github.event.pull_request.base.sha }}"
|
|
HEAD="${{ github.event.pull_request.head.sha }}"
|
|
|
|
python3 scripts/validation_targets.py --base-sha "$BASE" --head-sha "$HEAD" --output .validation-targets.txt
|
|
|
|
if [ -s .validation-targets.txt ]; then
|
|
python3 scripts/validate_metadata.py --check --targets-file .validation-targets.txt
|
|
python3 scripts/gen_rfc_index.py
|
|
python3 scripts/gen_summary.py
|
|
python3 scripts/validate_generated_outputs.py --targets-file .validation-targets.txt
|
|
else
|
|
echo "No markdown validation targets."
|
|
fi
|
|
|
|
python3 scripts/lint_targets.py --base-sha "$BASE" --head-sha "$HEAD" --output .lint-targets.txt
|
|
|
|
if [ ! -s .lint-targets.txt ]; then
|
|
echo "No non-raw markdown targets."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t files < .lint-targets.txt
|
|
|
|
npx markdownlint-cli2@0.12.1 --config .markdownlint.yaml "${files[@]}"
|
|
|
|
remark:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Remark Linter
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
BASE="${{ github.event.pull_request.base.sha }}"
|
|
HEAD="${{ github.event.pull_request.head.sha }}"
|
|
|
|
python3 scripts/lint_targets.py --base-sha "$BASE" --head-sha "$HEAD" --output .lint-targets.txt
|
|
|
|
if [ ! -s .lint-targets.txt ]; then
|
|
echo "No non-raw markdown targets."
|
|
exit 0
|
|
fi
|
|
|
|
mapfile -t files < .lint-targets.txt
|
|
npx remark --frail --no-stdout --rc-path .remarkrc.mjs "${files[@]}"
|