microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
abfd03ef8b9f81e150e6d564a43b755cc910c8e6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/frontmatter-validation.yml

97lines · modecode

1name: Frontmatter Validation
2
3on:
4 workflow_call:
5 inputs:
6 soft-fail:
7 description: 'Whether to continue on frontmatter validation errors'
8 required: false
9 type: boolean
10 default: false
11 changed-files-only:
12 description: 'Only validate changed markdown files'
13 required: false
14 type: boolean
15 default: true
16 skip-footer-validation:
17 description: 'Skip Copilot footer validation'
18 required: false
19 type: boolean
20 default: false
21 warnings-as-errors:
22 description: 'Treat warnings as errors'
23 required: false
24 type: boolean
25 default: true
26 footer-exclude-paths:
27 description: 'Comma-separated list of file patterns to exclude from footer validation (overrides script defaults)'
28 required: false
29 type: string
30 default: ''
31
32permissions:
33 contents: read
34
35jobs:
36 frontmatter-validation:
37 name: Validate Markdown Frontmatter
38 runs-on: ubuntu-latest
39 permissions:
40 contents: read
41 steps:
42 - name: Checkout code
43 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
44 with:
45 persist-credentials: false
46 fetch-depth: 0
47
48 - name: Create logs directory
49 shell: pwsh
50 run: |
51 New-Item -ItemType Directory -Force -Path logs | Out-Null
52
53 - name: Install PowerShell-Yaml
54 shell: pwsh
55 run: |
56 Install-Module -Name PowerShell-Yaml -Force -Scope CurrentUser
57
58 - name: Run Frontmatter Validation
59 shell: pwsh
60 run: |
61 $params = @{}
62
63 if ('${{ inputs.changed-files-only }}' -eq 'true') {
64 $params['ChangedFilesOnly'] = $true
65 }
66 if ('${{ inputs.skip-footer-validation }}' -eq 'true') {
67 $params['SkipFooterValidation'] = $true
68 }
69 if ('${{ inputs.warnings-as-errors }}' -eq 'true') {
70 $params['WarningsAsErrors'] = $true
71 }
72
73 # Pass footer exclude paths if provided (overrides script defaults)
74 $footerExcludeInput = '${{ inputs.footer-exclude-paths }}'
75 if ($footerExcludeInput -and $footerExcludeInput -ne '') {
76 $params['FooterExcludePaths'] = $footerExcludeInput -split ',' | ForEach-Object { $_.Trim() }
77 }
78
79 & scripts/linting/Validate-MarkdownFrontmatter.ps1 @params
80 continue-on-error: true
81
82 - name: Upload frontmatter validation results
83 if: always()
84 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v4.4.3
85 with:
86 name: frontmatter-validation-results
87 path: logs/frontmatter-validation-results.json
88 retention-days: 30
89
90 - name: Check results and fail if needed
91 if: ${{ !inputs.soft-fail }}
92 shell: pwsh
93 run: |
94 if ($env:FRONTMATTER_VALIDATION_FAILED -eq 'true') {
95 Write-Host "Frontmatter validation failed and soft-fail is false. Failing the job."
96 exit 1
97 }
98