Skip to content

Partnerinfo aanpassen aan laatste wijziginen in PISS #172

Partnerinfo aanpassen aan laatste wijziginen in PISS

Partnerinfo aanpassen aan laatste wijziginen in PISS #172

name: Markdown Naming Convention Check
on:
push:
branches:
- main
- develop
paths:
- 'markdownpages/**.md'
pull_request:
branches:
- main
- develop
paths:
- 'markdownpages/**.md'
# Allow manual triggering
workflow_dispatch:
# Define workflow permissions
permissions:
contents: read
pull-requests: read
jobs:
validate-markdown-naming:
name: Validate Markdown File Naming
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch full history for better file analysis
fetch-depth: 0
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install python-frontmatter PyYAML
# Make the validation script executable
- name: Make script executable
run: chmod +x scripts/markdown-naming-check.py
shell: bash
# Run the markdown naming validation
- name: Run markdown naming validation
id: validate
run: |
echo "Starting markdown file naming validation..."
python scripts/markdown-naming-check.py --root-path markdownpages
continue-on-error: true
# Generate detailed report for PR comments (if needed)
- name: Generate validation report
if: always()
id: report
run: |
echo "Generating detailed validation report..."
# Run the validation and capture both exit code and output
set +e # Temporarily disable exit on error
# Check which directory exists and run validation accordingly
if [ -d "markdownpages" ]; then
python scripts/markdown-naming-check.py --root-path markdownpages --json > validation-report.json
else
echo '{"error": "No markdownpages directory found", "success": false, "total_files_checked": 0, "violations_found": 0, "violations": []}' > validation-report.json
validation_exit_code=1
fi
validation_exit_code=$?
set -e # Re-enable exit on error
# Check if there are violations based on exit code
if [ $validation_exit_code -eq 0 ]; then
echo "validation_status=success" >> $GITHUB_OUTPUT
echo "All markdown files follow naming conventions! ✅" >> $GITHUB_STEP_SUMMARY
else
echo "validation_status=failure" >> $GITHUB_OUTPUT
echo "Markdown naming violations detected! ❌" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Validation Report" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`json" >> $GITHUB_STEP_SUMMARY
cat validation-report.json >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
shell: bash
# Upload validation report as artifact
- name: Upload validation report
if: always()
uses: actions/upload-artifact@v4
with:
name: markdown-naming-validation-report
path: validation-report.json
retention-days: 30
if-no-files-found: warn
# Fail the job if validation failed
- name: Check validation result
if: steps.report.outputs.validation_status == 'failure'
run: |
echo "❌ Markdown naming validation failed!"
echo "Please check the validation report and rename files to follow kebab-case convention."
exit 1
shell: bash
# Success message
- name: Validation success
if: steps.report.outputs.validation_status == 'success'
run: |
echo "✅ All markdown files follow the naming convention!"
echo "Validation completed successfully."
shell: bash
# Summary job that runs after validation
summary:
name: Validation Summary
runs-on: ubuntu-latest
needs: validate-markdown-naming
if: always()
steps:
- name: Download validation report
uses: actions/download-artifact@v4
with:
name: markdown-naming-validation-report
- name: Display summary
run: |
echo "## Markdown Naming Validation Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f validation-report.json ]; then
# Extract key metrics from the JSON report
total_files=$(jq -r '.total_files_checked // 0' validation-report.json)
violations=$(jq -r '.violations_found // 0' validation-report.json)
success=$(jq -r '.success // false' validation-report.json)
echo "- **Total markdown files checked:** $total_files" >> $GITHUB_STEP_SUMMARY
echo "- **Violations found:** $violations" >> $GITHUB_STEP_SUMMARY
echo "- **Status:** $([ "$success" = "true" ] && echo "✅ PASSED" || echo "❌ FAILED")" >> $GITHUB_STEP_SUMMARY
if [ "$violations" -gt "0" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Action Required" >> $GITHUB_STEP_SUMMARY
echo "Please rename the files listed in the validation report to follow kebab-case convention." >> $GITHUB_STEP_SUMMARY
fi
else
echo "- **Status:** ❌ Validation report not found" >> $GITHUB_STEP_SUMMARY
fi
shell: bash