-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (101 loc) · 3.34 KB
/
Build-Docs.yml
File metadata and controls
111 lines (101 loc) · 3.34 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
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
jobs:
Build-Docs:
name: Build-Docs
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v5
with:
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
uses: super-linter/super-linter/slim@latest
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_GITLEAKS: false
VALIDATE_JSCPD: false
VALIDATE_JSON_PRETTIER: false
VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_YAML_PRETTIER: false