Commit 6a2826f
authored
⚙️ [Maintenance]: Adopt Process-PSModule v6.1.1 and showcase test data (secret + variable) in tests (#26)
Updates the shared `Process-PSModule` reusable workflow from `v5.4.3` to
the latest `v6.1.1`, and adds a worked example of the v6 `TestData`
feature so module authors can see how to pass a secret and a variable
down to their tests.
## Changed: Process-PSModule bumped to v6.1.1
The template now consumes `Process-PSModule` `v6.1.1` (was `v5.4.3`).
The v6 major release replaced the fixed `TEST_*` workflow secret inputs
with a single `TestData` object; the template did not use any `TEST_*`
secrets, and the `.github/PSModule.yml` settings keys used here
(`Test.CodeCoverage.PercentTarget`, `Linter.env`) remain valid in v6.
## New: Showcase for passing test data to the module tests
`.github/workflows/Process-PSModule.yml` now passes a `TestData` object
with one secret and one variable:
```yaml
TestData: >-
{ "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" },
"variables": { "TEST_VARIABLE": ${{ toJSON(vars.TEST_VARIABLE) }} } }
```
- Entries in `secrets` are masked in the logs; entries in `variables`
are not.
- Both are exposed to the module test jobs as `$env:<name>`.
`tests/Environment.Tests.ps1` consumes them and asserts they arrive. The
tests **skip** when the values are absent, so a fresh repository created
from this template stays green (GitHub does not copy repository
secrets/variables to template instances).
## Technical Details
- `.github/workflows/Process-PSModule.yml`: pin `workflow.yml@60bdf8a…`
(`v5.4.3`) → `@ea19a3eb1293246d1b00e4faae1544442c3be0ec` (`v6.1.1`); add
the commented `TestData` block.
- `tests/Environment.Tests.ps1`: new, mirrors the sibling test-file
header; `-Skip` when the env var is empty; PSScriptAnalyzer-clean
against `.github/linters/.powershell-psscriptanalyzer.psd1`.
- Non-sensitive demo repository secret `TEST_SECRET` and variable
`TEST_VARIABLE` were added to this repo so its own CI exercises the
showcase; both are safe placeholder values.
- Validated locally with Pester: 2 passed with the env vars set, 2
skipped without. PR checks (pull_request event) are green.
- Supersedes Dependabot PR #23 (bump to `5.5.7`), which Dependabot will
close automatically once this merges to a higher version.
### Known limitation on v6.1.1
On v6.1.0/v6.1.1 the `Plan` job fails on `schedule` and
`workflow_dispatch` events (its `Resolve-Version` step requires a
`pull_request` event), so the template's scheduled/manual runs will fail
until fixed upstream. `pull_request` runs — the primary development path
— are unaffected. Tracked in PSModule/Process-PSModule#373.1 parent 59fc671 commit 6a2826f
2 files changed
Lines changed: 41 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments