Skip to content

Commit b2fe12f

Browse files
🪲 [Fix]: Documentation linting (#14)
## Description - Fix documentation linting ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 4a32e68 commit b2fe12f

File tree

3 files changed

+20
-77
lines changed

3 files changed

+20
-77
lines changed

.github/workflows/Workflow-Test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on: [pull_request]
77
permissions:
88
contents: write
99
pull-requests: write
10+
statuses: write
1011

1112
jobs:
1213
WorkflowTestDefault:

.github/workflows/workflow.yml

Lines changed: 15 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -52,49 +52,15 @@ env:
5252
permissions:
5353
contents: write
5454
pull-requests: write
55+
statuses: write
5556

5657
jobs:
57-
TestSourceCode:
58-
name: Test source code
59-
strategy:
60-
fail-fast: false
61-
matrix:
62-
shell: [pwsh]
63-
os: [ubuntu-latest, macos-latest, windows-latest]
64-
include:
65-
- shell: powershell
66-
os: windows-latest
67-
runs-on: ${{ matrix.os }}
68-
steps:
69-
- name: Checkout Code
70-
uses: actions/checkout@v4
71-
with:
72-
fetch-depth: 0
73-
74-
- name: Initialize environment
75-
uses: PSModule/Initialize-PSModule@v1
76-
with:
77-
Version: ${{ inputs.Version }}
78-
Prerelease: ${{ inputs.Prerelease }}
79-
Shell: ${{ matrix.shell }}
80-
81-
- name: Test source code
82-
uses: PSModule/Test-PSModule@v1
83-
if: ${{ inputs.SkipTests != true }}
84-
with:
85-
Name: ${{ inputs.Name }}
86-
Path: ${{ inputs.Path }}
87-
Shell: ${{ matrix.shell }}
88-
RunModuleTests: false
89-
9058
BuildModule:
9159
name: Build module
9260
runs-on: ubuntu-latest
9361
steps:
9462
- name: Checkout Code
9563
uses: actions/checkout@v4
96-
with:
97-
fetch-depth: 0
9864

9965
- name: Initialize environment
10066
uses: PSModule/Initialize-PSModule@v1
@@ -113,21 +79,21 @@ jobs:
11379
- name: Upload module artifact
11480
uses: actions/upload-artifact@v4
11581
with:
116-
name: ${{ inputs.Name }}-module
82+
name: module
11783
path: ${{ inputs.ModulesOutputPath }}
11884
if-no-files-found: error
11985
retention-days: 1
12086

12187
- name: Upload docs artifact
12288
uses: actions/upload-artifact@v4
12389
with:
124-
name: ${{ inputs.Name }}-docs
90+
name: docs
12591
path: ${{ inputs.DocsOutputPath }}
12692
if-no-files-found: error
12793
retention-days: 1
12894

129-
TestBuildModule:
130-
name: Test built module
95+
TestModule:
96+
name: Test module
13197
needs: BuildModule
13298
strategy:
13399
fail-fast: false
@@ -139,6 +105,9 @@ jobs:
139105
os: windows-latest
140106
runs-on: ${{ matrix.os }}
141107
steps:
108+
- name: Checkout Code
109+
uses: actions/checkout@v4
110+
142111
- name: Initialize environment
143112
uses: PSModule/Initialize-PSModule@v1
144113
with:
@@ -149,7 +118,7 @@ jobs:
149118
- name: Download module artifact
150119
uses: actions/download-artifact@v4
151120
with:
152-
name: ${{ inputs.Name }}-module
121+
name: module
153122
path: ${{ inputs.ModulesOutputPath }}
154123

155124
- name: Test built module
@@ -173,35 +142,29 @@ jobs:
173142
- name: Download docs artifact
174143
uses: actions/download-artifact@v4
175144
with:
176-
name: ${{ inputs.Name }}-docs
177-
path: ${{ inputs.DocsOutputPath }}
145+
name: docs
178146

179-
- name: Git add - For linting
147+
- name: Commit docs for linting
180148
run: |
149+
git config --global user.name "Github Actions"
181150
git config --global user.email "github-actions[bot]@users.noreply.github.com"
182-
git config --global user.name "github-actions[bot]"
183151
git add .
184152
git commit -m "Update documentation"
185153
186154
- name: Lint documentation
187155
uses: super-linter/super-linter/slim@latest
188156
env:
189157
GITHUB_TOKEN: ${{ github.token }}
190-
VALIDATE_NATURAL_LANGUAGE: true
191-
VALIDATE_MARKDOWN: true
192158

193159
PublishModule:
194160
name: Publish module
195161
needs:
196-
- TestSourceCode
197-
- TestBuildModule
162+
- TestModule
198163
- LintDocs
199164
runs-on: ubuntu-latest
200165
steps:
201166
- name: Checkout Code
202167
uses: actions/checkout@v4
203-
with:
204-
fetch-depth: 0
205168

206169
- name: Initialize environment
207170
uses: PSModule/Initialize-PSModule@v1
@@ -212,13 +175,13 @@ jobs:
212175
- name: Download module artifact
213176
uses: actions/download-artifact@v4
214177
with:
215-
name: ${{ inputs.Name }}-module
178+
name: module
216179
path: ${{ inputs.ModulesOutputPath }}
217180

218181
- name: Download docs artifact
219182
uses: actions/download-artifact@v4
220183
with:
221-
name: ${{ inputs.Name }}-docs
184+
name: docs
222185
path: ${{ inputs.DocsOutputPath }}
223186

224187
- name: Publish module

README.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ The workflow is designed to be trigger on pull requests to the repository's defa
1818
When a pull request is opened, closed, reopened, synchronized (push), or labeled, the workflow will run.
1919
Depending on the labels in the pull requests, the workflow will result in different outcomes.
2020

21-
- [Initialize-PSModule](https://github.com/PSModule/Initialize-PSModule/) - Prepares the runner with all the framework requirements.
22-
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Tests the source code using only PSScriptAnalyzer and the PSModule test suites.
2321
- [Build-PSModule](https://github.com/PSModule/Build-PSModule/) - Compiles the repository into an efficient PowerShell module.
24-
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Tests the compiled module using PSScriptAnalyzer, PSModule and module tests suites from the module repository.
22+
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Tests the compiled module using PSScriptAnalyzer, PSModule and module tests suites from the module repository. This runs on 4 different environments to check compatibility.
23+
- PowerShell 7.x on Windows, Ubuntu and macOS.
24+
- Windows PowerShell 5.1 on Windows.
2525
- [Publish-PSModule](https://github.com/PSModule/Publish-PSModule/) - Publishes the module to the PowerShell Gallery, docs to GitHub Pages, and creates a release on the GitHub repository.
2626

2727
To use the workflow, create a new file in the `.github/workflows` directory of the module repository and add the following content.
@@ -79,28 +79,6 @@ The following secrets are **required** for the workflow to run:
7979
| `GITHUB_TOKEN` | `github` context | The token used to authenticate with GitHub. | `${{ secrets.GITHUB_TOKEN }}` |
8080
| `APIKey` | GitHub secrets | The API key for the PowerShell Gallery. | N/A |
8181

82-
## In detail
83-
84-
The following steps will be run when the workflow triggers:
85-
86-
- Checkout Code [actions/checkout](https://github.com/actions/checkout/)
87-
- Checks out the code of the repository to the runner.
88-
- Initialize environment [PSModule/Initialize-PSModule](https://github.com/PSModule/Initialize-PSModule/)
89-
- Test source code [PSModule/Test-PSModule](https://github.com/PSModule/Test-PSModule/)
90-
- Looks for the module in the `src` directory and runs the PSScriptAnalyzer and PSModule testing suite on the code.
91-
- Build module [PSModule/Build-PSModule](https://github.com/PSModule/Build-PSModule/)
92-
- Build the manifest file for the module.
93-
- Compiles the `src` directory into a PowerShell module and docs.
94-
- The compiled module is output to the `outputs/modules` directory.
95-
- The compiled docs are output to the `outputs/docs` directory.
96-
- Test built module [PSModule/Test-PSModule](https://github.com/PSModule/Test-PSModule/)
97-
- Looks for the module in the `outputs/modules` directory and runs the PSScriptAnalyzer, PSModule testing suite and the custom module tests from the `tests` directory on the code.
98-
- Publish module [PSModule/Publish-PSModule](https://github.com/PSModule/Publish-PSModule/)
99-
- Calculates the next version of the module based on the latest release and labels on the PR.
100-
- Publishes the module to the PowerShell Gallery using the API key stored in as a secret named `APIKey`.
101-
- Publishes the docs to GitHub Pages from the `outputs/docs` directory.
102-
- Creates a release on the GitHub repository with the source code.
103-
10482
## Permissions
10583

10684
The action requires the following permissions:
@@ -111,6 +89,7 @@ If running the action in a restrictive mode, the following permissions needs to
11189
permissions:
11290
contents: write # Required to create releases
11391
pull-requests: write # Required to create comments on the PRs
92+
statuses: write # Required to update the status of the PRs from the linter
11493
```
11594
11695
## Compatibility

0 commit comments

Comments
 (0)