Skip to content

Commit 59542da

Browse files
⚙️ [Maintenance]: Declare test secrets and variables via Process-PSModule TestSecrets/TestVariables
Replaces secrets: inherit with an explicit declaration of exactly what the module tests need: CONFLUENCE_API_TOKEN via TestSecrets (masked) and CONFLUENCE_API_BASE_URI / CONFLUENCE_USERNAME / CONFLUENCE_SPACE_KEY via TestVariables (not masked). Pinned to the Process-PSModule feature branch (PR #365) until it is released.
1 parent cb00658 commit 59542da

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

.github/workflows/Process-PSModule.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,24 @@ permissions:
2727

2828
jobs:
2929
Process-PSModule:
30-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@ce64918acc96dda73eb78f827036b794bfa6fa1a # v5.5.7
31-
secrets: inherit
30+
# Pinned to the TestSecrets/TestVariables feature branch of Process-PSModule (PR #365).
31+
# Repin to the released tag once that change ships.
32+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@5ae2f4cfec688512e4889c014493dd581bfe7c38 # feat/52-test-secrets
33+
secrets:
34+
# PowerShell Gallery API key used to publish the module.
35+
APIKey: ${{ secrets.APIKey }}
36+
# Secrets the module's tests need, exposed as environment variables (masked). Only what the
37+
# tests require is passed - secrets: inherit is intentionally not used. The integration tests
38+
# are skipped when CONFLUENCE_API_TOKEN is not available (forks / PRs without access).
39+
TestSecrets: >-
40+
{
41+
"CONFLUENCE_API_TOKEN": ${{ toJSON(secrets.CONFLUENCE_API_TOKEN) }}
42+
}
43+
with:
44+
# Non-secret configuration the module's tests need, exposed as environment variables (not masked).
45+
TestVariables: >-
46+
{
47+
"CONFLUENCE_API_BASE_URI": ${{ toJSON(vars.CONFLUENCE_API_BASE_URI) }},
48+
"CONFLUENCE_USERNAME": ${{ toJSON(vars.CONFLUENCE_USERNAME) }},
49+
"CONFLUENCE_SPACE_KEY": ${{ toJSON(vars.CONFLUENCE_SPACE_KEY) }}
50+
}

tests/Confluence.Tests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ Describe 'Confluence' {
6868
}
6969
}
7070

71-
# Integration tests run only when live credentials are provided through the
72-
# repository's GitHub Environment secrets. They are skipped locally and on
73-
# pull requests where the secrets are not available.
71+
# Integration tests run only when live credentials are provided. The calling workflow supplies
72+
# them through Process-PSModule's TestSecrets (CONFLUENCE_API_TOKEN, masked) and TestVariables
73+
# (CONFLUENCE_API_BASE_URI, CONFLUENCE_USERNAME, CONFLUENCE_SPACE_KEY), which are exposed as
74+
# environment variables. They are skipped locally and wherever the API token is not available.
7475
Context 'Integration' -Skip:([string]::IsNullOrEmpty($env:CONFLUENCE_API_TOKEN)) {
7576
BeforeAll {
7677
$secureToken = ConvertTo-SecureString -String $env:CONFLUENCE_API_TOKEN -AsPlainText -Force

0 commit comments

Comments
 (0)