microsoft/hve-core

Public

mirrored from https://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-hardcoded-paths-in-artifacts

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/link-lang-check.yml

84lines · modecode

1name: Link Language Check
2
3on:
4 workflow_call:
5 inputs:
6 soft-fail:
7 description: 'Whether to continue on language path violations'
8 required: false
9 type: boolean
10 default: false
11
12permissions:
13 contents: read
14
15jobs:
16 link-lang-check:
17 name: Check for Language Paths in URLs
18 runs-on: ubuntu-latest
19 permissions:
20 contents: read
21 steps:
22 - name: Checkout code
23 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
24 with:
25 persist-credentials: false
26
27 - name: Create logs directory
28 shell: pwsh
29 run: |
30 New-Item -ItemType Directory -Force -Path logs | Out-Null
31
32 - name: Run Link Language Check
33 shell: pwsh
34 run: |
35 & scripts/linting/Invoke-LinkLanguageCheck.ps1 -ExcludePaths 'scripts/tests/**'
36 continue-on-error: true
37
38 - name: Upload results
39 if: always()
40 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v4.4.3
41 with:
42 name: link-lang-check-results
43 path: logs/link-lang-check-results.json
44 retention-days: 30
45
46 - name: Check results and fail if needed
47 if: ${{ !inputs.soft-fail }}
48 shell: pwsh
49 run: |
50 if ($env:LINK_LANG_FAILED -eq 'true') {
51 $resultsPath = 'logs/link-lang-check-results.json'
52
53 if (Test-Path -LiteralPath $resultsPath) {
54 try {
55 $results = Get-Content -LiteralPath $resultsPath -Raw | ConvertFrom-Json
56 $totalIssues = [int]($results.summary.total_issues)
57 $filesAffected = [int]($results.summary.files_affected)
58
59 if ($results.issues -and $results.issues.Count -gt 0) {
60 if ($totalIssues -le 0) {
61 $totalIssues = [int]$results.issues.Count
62 }
63
64 if ($filesAffected -le 0) {
65 $filesAffected = [int](($results.issues | Select-Object -ExpandProperty file -Unique).Count)
66 }
67
68 Write-Host "❌ Link language check failed with $totalIssues issue(s) in $filesAffected file(s)."
69
70 foreach ($issue in $results.issues) {
71 Write-Host " ⚠️ $($issue.file):$($issue.line_number) - $($issue.original_url)"
72 }
73 } else {
74 Write-Host 'Link language check failed and no issue entries were found in logs/link-lang-check-results.json.'
75 }
76 } catch {
77 Write-Host 'Link language check failed and logs/link-lang-check-results.json could not be parsed.'
78 }
79 } else {
80 Write-Host 'Link language check failed and logs/link-lang-check-results.json was not found.'
81 }
82
83 exit 1
84 }
85