-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (96 loc) · 3.95 KB
/
Build-Docs.yml
File metadata and controls
108 lines (96 loc) · 3.95 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Build-Docs
on:
workflow_call:
inputs:
Settings:
type: string
description: The complete settings object.
required: true
permissions:
contents: read # to checkout the repo
statuses: write # to create commit status
jobs:
Build-Docs:
name: Build-Docs
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Download module artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: module
path: ${{ fromJson(inputs.Settings).WorkingDirectory }}/outputs/module
- name: Document module
uses: PSModule/Document-PSModule@dc5b329f840f7803ec02d34a42ee725bca39db5f # v1.0.16
with:
Name: ${{ fromJson(inputs.Settings).Name }}
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
- name: Upload docs artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: docs
path: ${{ fromJson(inputs.Settings).WorkingDirectory }}/outputs/docs
if-no-files-found: error
retention-days: 1
- name: Commit all changes
uses: PSModule/GitHub-Script@0097f3bbe3f413f3b577b9bcc600727b0ca3201a # v1.7.10
with:
Debug: ${{ fromJson(inputs.Settings).Debug }}
Prerelease: ${{ fromJson(inputs.Settings).Prerelease }}
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
Version: ${{ fromJson(inputs.Settings).Version }}
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
Script: |
# Rename the gitignore file to .gitignore.bak
if (Test-Path -Path .gitignore) {
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
}
try {
# Add all changes to the repository
git add .
git commit -m 'Update documentation'
} catch {
Write-Host "No changes to commit"
}
# Restore the gitignore file
if (Test-Path -Path .gitignore.bak) {
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
}
- name: Lint documentation
id: super-linter
uses: super-linter/super-linter/slim@61abc07d755095a68f4987d1c2c3d1d64408f1f9 # v8.5.0
env:
RUN_LOCAL: true
DEFAULT_BRANCH: main
DEFAULT_WORKSPACE: ${{ fromJson(inputs.Settings).WorkingDirectory }}
FILTER_REGEX_INCLUDE: ${{ fromJson(inputs.Settings).WorkingDirectory }}/outputs/docs
ENABLE_GITHUB_ACTIONS_GROUP_TITLE: true
GITHUB_TOKEN: ${{ github.token }}
VALIDATE_ALL_CODEBASE: true
VALIDATE_BIOME_FORMAT: false
VALIDATE_BIOME_LINT: false
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
VALIDATE_JSON_PRETTIER: false
VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_YAML_PRETTIER: false
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: false
SAVE_SUPER_LINTER_SUMMARY: true
- name: Post super-linter summary
if: failure() || fromJson(inputs.Settings).Build.Docs.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
}