You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🚀 [Feature]: Add TestVariables input for non-secret test configuration
Adds a TestVariables workflow input (symmetric to TestSecrets) that exposes caller-selected NON-SECRET values as environment variables in the module test jobs, without masking. The expose step is refactored into a shared helper that masks secrets but not variables. Self-tests prove it via a dedicated PSMODULE_TEST_VARIABLE repo variable (asserted value + length). README documents both.
Copy file name to clipboardExpand all lines: README.md
+27-17Lines changed: 27 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -394,6 +394,7 @@ jobs:
394
394
| `Prerelease` | `boolean` | Whether to use a prerelease version of the 'GitHub' module. | `false` | `false` |
395
395
| `WorkingDirectory` | `string` | The path to the root of the repo. | `false` | `'.'` |
396
396
| `ImportantFilePatterns` | `string` | Newline-separated list of regular expression patterns that identify important files. Changes matching these patterns trigger build, test, and publish stages. When set, fully replaces the defaults. | `false` | `^src/\n^README\.md$` |
397
+
| `TestVariables` | `string` | A JSON object mapping environment variable names to non-secret values, exposed (unmasked) as environment variables to the module test jobs. Built by the caller from `toJSON(vars.<name>)`. | `false` | `''` |
397
398
398
399
### Secrets
399
400
@@ -405,13 +406,16 @@ credentials that are exposed. `secrets: inherit` is intentionally not required.
405
406
| `APIKey` | GitHub secrets | The API key for the PowerShell Gallery, used to publish the module. | Yes |
406
407
| `TestSecrets` | GitHub secrets | A JSON object mapping environment variable names to secret values, exposed to the module test jobs. | No |
407
408
408
-
#### Passing secrets to the tests
409
+
#### Passing secrets and variables to the tests
409
410
410
-
`TestSecrets`lets a module expose any number of caller-defined secrets to its test jobs
411
-
(`BeforeAll-ModuleLocal`, `Test-ModuleLocal` and `AfterAll-ModuleLocal`) without changing the shared
412
-
workflow. The calling workflow decides exactly which secrets are passed by building a single-line JSON object.
413
-
Use `toJSON(secrets.<name>)` so that quoting and multi-line values (such as private keys) are encoded
414
-
correctly. A folded `>-` block keeps the source readable while producing a single-line value:
411
+
`TestSecrets`(a secret) and `TestVariables` (a regular input) let a module expose any number of
412
+
caller-defined values to its test jobs (`BeforeAll-ModuleLocal`, `Test-ModuleLocal` and
413
+
`AfterAll-ModuleLocal`) without changing the shared workflow. Use `TestSecrets` for sensitive values
414
+
(masked in the logs) and `TestVariables` for non-secret configuration such as URLs, usernames and
415
+
identifiers (not masked). The calling workflow decides exactly what is passed by building single-line
416
+
JSON objects. Use `toJSON(secrets.<name>)` / `toJSON(vars.<name>)` so that quoting and multi-line
417
+
values (such as private keys) are encoded correctly. A folded `>-` block keeps the source readable
0 commit comments