-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 2.31 KB
/
Lint-Repository.yml
File metadata and controls
72 lines (61 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Lint-Repository
on:
workflow_call:
inputs:
Settings:
type: string
description: The settings object as a JSON string.
required: true
permissions:
contents: read # to checkout the repository
statuses: write # to update the status of the workflow from linter
jobs:
Lint-Repository:
name: Lint code base
runs-on: ubuntu-latest
env:
Settings: ${{ inputs.Settings }}
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Load dynamic envs
shell: pwsh
run: |
Write-Host "Loading settings for super-linter:"
$settings = $env:Settings | ConvertFrom-Json -AsHashtable
$linter = $settings.Linter
$env = $linter.env
foreach ($key in $env.Keys) {
$value = $env[$key]
if ($value -is [bool]) {
$value = $value.ToString().ToLower()
}
Write-Host "$key = $value"
# Persist for following steps in this job
"$key=$value" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Lint code base
id: super-linter
uses: super-linter/super-linter@61abc07d755095a68f4987d1c2c3d1d64408f1f9 # v8.5.0
env:
GITHUB_TOKEN: ${{ github.token }}
DEFAULT_WORKSPACE: ${{ fromJson(env.Settings).WorkingDirectory }}
FILTER_REGEX_INCLUDE: ${{ fromJson(env.Settings).WorkingDirectory }}
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: false
SAVE_SUPER_LINTER_SUMMARY: true
- name: Post super-linter summary
if: failure() || fromJson(env.Settings).Linter.ShowSummaryOnSuccess == true
shell: pwsh
env:
SUPER_LINTER_OUTCOME: ${{ steps.super-linter.outcome }}
run: |
$summaryPath = Join-Path $env:GITHUB_WORKSPACE 'super-linter-output' 'super-linter-summary.md'
Get-Content $summaryPath | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8
$failed = $env:SUPER_LINTER_OUTCOME -eq 'failure'
if ($failed) {
Write-Host "::error::Super-linter found issues. Please review the summary above."
exit 1
}