-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (121 loc) · 4.35 KB
/
Build-Docs.yml
File metadata and controls
132 lines (121 loc) · 4.35 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Build-Docs
on:
workflow_call:
inputs:
Name:
type: string
description: The name of the module to process. Scripts default to the repository name if nothing is specified.
required: false
Debug:
type: boolean
description: Enable debug output.
required: false
default: false
Verbose:
type: boolean
description: Enable verbose output.
required: false
default: false
Version:
type: string
description: Specifies the version of the GitHub module to be installed. The value must be an exact version.
required: false
default: ''
Prerelease:
type: boolean
description: Whether to use a prerelease version of the 'GitHub' module.
required: false
default: false
WorkingDirectory:
type: string
description: The working directory where the script will run from.
required: false
default: '.'
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@v5
with:
persist-credentials: false
fetch-depth: 0
- name: Download module artifact
uses: actions/download-artifact@v5
with:
name: module
path: ${{ inputs.WorkingDirectory }}/outputs/module
- name: Document module
uses: PSModule/Document-PSModule@v1
with:
Name: ${{ inputs.Name }}
WorkingDirectory: ${{ inputs.WorkingDirectory }}
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: ${{ inputs.WorkingDirectory }}/outputs/docs
if-no-files-found: error
retention-days: 1
- name: Commit all changes
uses: PSModule/GitHub-Script@v1
with:
Debug: ${{ inputs.Debug }}
Prerelease: ${{ inputs.Prerelease }}
Verbose: ${{ inputs.Verbose }}
Version: ${{ inputs.Version }}
WorkingDirectory: ${{ inputs.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@7bba2eeb89d01dc9bfd93c497477a57e72c83240 # v8.2.0
env:
FILTER_REGEX_INCLUDE: outputs/docs
DEFAULT_BRANCH: main
DEFAULT_WORKSPACE: ${{ inputs.WorkingDirectory }}
ENABLE_GITHUB_ACTIONS_GROUP_TITLE: true
GITHUB_TOKEN: ${{ github.token }}
RUN_LOCAL: true
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 on failure
if: steps.super-linter.outcome == 'failure'
shell: pwsh
run: |
Write-Host "Super-linter found issues. Generating summary..."
$summaryPath = Join-Path $env:GITHUB_WORKSPACE 'super-linter-output' 'super-linter-summary.md'
if (Test-Path $summaryPath) {
Get-Content $summaryPath | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
} else {
Write-Host "::warning::Super-linter failed but summary file not found at: $summaryPath"
}
Write-Host "::error::Super-linter found issues. Please review the summary above."
exit 1