microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
.github/workflows/link-lang-check.yml
53lines · modecode
| 1 | name: Link Language Check |
| 2 | |
| 3 | on: |
| 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 | |
| 12 | permissions: |
| 13 | contents: read |
| 14 | |
| 15 | jobs: |
| 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 | Write-Host "Link language check failed and soft-fail is false. Failing the job." |
| 52 | exit 1 |
| 53 | } |
| 54 | |