microsoft/hve-core

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-copilot-code-review

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/frontmatter-validation.yml

86lines · 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
27permissions:
28 contents: read
29
30jobs:
31 frontmatter-validation:
32 name: Validate Markdown Frontmatter
33 runs-on: ubuntu-latest
34 permissions:
35 contents: read
36 steps:
37 - name: Harden Runner
38 uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.10.2
39 with:
40 egress-policy: audit
41
42 - name: Checkout code
43 uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 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: Run Frontmatter Validation
54 shell: pwsh
55 run: |
56 $params = @{}
57
58 if ('${{ inputs.changed-files-only }}' -eq 'true') {
59 $params['ChangedFilesOnly'] = $true
60 }
61 if ('${{ inputs.skip-footer-validation }}' -eq 'true') {
62 $params['SkipFooterValidation'] = $true
63 }
64 if ('${{ inputs.warnings-as-errors }}' -eq 'true') {
65 $params['WarningsAsErrors'] = $true
66 }
67
68 & scripts/linting/Validate-MarkdownFrontmatter.ps1 @params
69 continue-on-error: true
70
71 - name: Upload frontmatter validation results
72 if: always()
73 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v4.4.3
74 with:
75 name: frontmatter-validation-results
76 path: logs/frontmatter-validation-results.json
77 retention-days: 30
78
79 - name: Check results and fail if needed
80 if: ${{ !inputs.soft-fail }}
81 shell: pwsh
82 run: |
83 if ($env:FRONTMATTER_VALIDATION_FAILED -eq 'true') {
84 Write-Host "Frontmatter validation failed and soft-fail is false. Failing the job."
85 exit 1
86 }