Skip to content

Commit 9bf1a23

Browse files
🩹 [Patch]: Make secrets available in BeforeAll and AfterAll jobs (#254)
This patch release makes test secrets available in the `BeforeAll-ModuleLocal` and `AfterAll-ModuleLocal` workflow jobs, enabling proper test setup and teardown operations that require authentication credentials. ### Changes - **Updated workflow files** to pass test secrets through reusable workflow calls: - [.github/workflows/BeforeAll-ModuleLocal.yml](.github/workflows/BeforeAll-ModuleLocal.yml) - Added secrets input and environment variable mapping - [.github/workflows/AfterAll-ModuleLocal.yml](.github/workflows/AfterAll-ModuleLocal.yml) - Added secrets input and environment variable mapping - [.github/workflows/workflow.yml](.github/workflows/workflow.yml) - Configured secret passing to BeforeAll and AfterAll jobs
1 parent bf70b29 commit 9bf1a23

File tree

3 files changed

+88
-5
lines changed

3 files changed

+88
-5
lines changed

‎.github/workflows/AfterAll-ModuleLocal.yml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,43 @@ name: AfterAll-ModuleLocal
22

33
on:
44
workflow_call:
5+
secrets:
6+
TEST_APP_ENT_CLIENT_ID:
7+
description: The client ID of an Enterprise GitHub App for running tests.
8+
required: false
9+
TEST_APP_ENT_PRIVATE_KEY:
10+
description: The private key of an Enterprise GitHub App for running tests.
11+
required: false
12+
TEST_APP_ORG_CLIENT_ID:
13+
description: The client ID of an Organization GitHub App for running tests.
14+
required: false
15+
TEST_APP_ORG_PRIVATE_KEY:
16+
description: The private key of an Organization GitHub App for running tests.
17+
required: false
18+
TEST_USER_ORG_FG_PAT:
19+
description: The fine-grained personal access token with org access for running tests.
20+
required: false
21+
TEST_USER_USER_FG_PAT:
22+
description: The fine-grained personal access token with user account access for running tests.
23+
required: false
24+
TEST_USER_PAT:
25+
description: The classic personal access token for running tests.
26+
required: false
527
inputs:
628
Settings:
729
type: string
830
description: The complete settings object including test suites.
931
required: true
1032

33+
env:
34+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
35+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
36+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
37+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
38+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
39+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
40+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
41+
1142
permissions:
1243
contents: read # to checkout the repo
1344

‎.github/workflows/BeforeAll-ModuleLocal.yml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,43 @@ name: BeforeAll-ModuleLocal
22

33
on:
44
workflow_call:
5+
secrets:
6+
TEST_APP_ENT_CLIENT_ID:
7+
description: The client ID of an Enterprise GitHub App for running tests.
8+
required: false
9+
TEST_APP_ENT_PRIVATE_KEY:
10+
description: The private key of an Enterprise GitHub App for running tests.
11+
required: false
12+
TEST_APP_ORG_CLIENT_ID:
13+
description: The client ID of an Organization GitHub App for running tests.
14+
required: false
15+
TEST_APP_ORG_PRIVATE_KEY:
16+
description: The private key of an Organization GitHub App for running tests.
17+
required: false
18+
TEST_USER_ORG_FG_PAT:
19+
description: The fine-grained personal access token with org access for running tests.
20+
required: false
21+
TEST_USER_USER_FG_PAT:
22+
description: The fine-grained personal access token with user account access for running tests.
23+
required: false
24+
TEST_USER_PAT:
25+
description: The classic personal access token for running tests.
26+
required: false
527
inputs:
628
Settings:
729
type: string
830
description: The complete settings object including test suites.
931
required: true
1032

33+
env:
34+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
35+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
36+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
37+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
38+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
39+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
40+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
41+
1142
permissions:
1243
contents: read # to checkout the repo
1344

‎.github/workflows/workflow.yml‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ jobs:
145145
- Build-Module
146146
- Get-Settings
147147
uses: ./.github/workflows/Test-Module.yml
148-
secrets: inherit
149148
with:
150149
Settings: ${{ needs.Get-Settings.outputs.Settings }}
151150

@@ -157,6 +156,14 @@ jobs:
157156
BeforeAll-ModuleLocal:
158157
if: fromJson(needs.Get-Settings.outputs.Settings).Run.BeforeAllModuleLocal && needs.Build-Module.result == 'success' && !cancelled()
159158
uses: ./.github/workflows/BeforeAll-ModuleLocal.yml
159+
secrets:
160+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
161+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
162+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
163+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
164+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
165+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
166+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
160167
needs:
161168
- Build-Module
162169
- Get-Settings
@@ -175,7 +182,14 @@ jobs:
175182
- Get-Settings
176183
- BeforeAll-ModuleLocal
177184
uses: ./.github/workflows/Test-ModuleLocal.yml
178-
secrets: inherit
185+
secrets:
186+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
187+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
188+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
189+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
190+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
191+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
192+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
179193
with:
180194
Settings: ${{ needs.Get-Settings.outputs.Settings }}
181195

@@ -187,6 +201,14 @@ jobs:
187201
AfterAll-ModuleLocal:
188202
if: fromJson(needs.Get-Settings.outputs.Settings).Run.AfterAllModuleLocal && needs.Test-ModuleLocal.result != 'skipped' && always()
189203
uses: ./.github/workflows/AfterAll-ModuleLocal.yml
204+
secrets:
205+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
206+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
207+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
208+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
209+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
210+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
211+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
190212
needs:
191213
- Get-Settings
192214
- Test-ModuleLocal
@@ -207,7 +229,6 @@ jobs:
207229
- Test-Module
208230
- Test-ModuleLocal
209231
uses: ./.github/workflows/Get-TestResults.yml
210-
secrets: inherit
211232
with:
212233
Settings: ${{ needs.Get-Settings.outputs.Settings }}
213234

@@ -223,7 +244,6 @@ jobs:
223244
- Test-Module
224245
- Test-ModuleLocal
225246
uses: ./.github/workflows/Get-CodeCoverage.yml
226-
secrets: inherit
227247
with:
228248
Settings: ${{ needs.Get-Settings.outputs.Settings }}
229249

@@ -235,7 +255,8 @@ jobs:
235255
Publish-Module:
236256
if: fromJson(needs.Get-Settings.outputs.Settings).Run.PublishModule && needs.Get-Settings.result == 'success' && !cancelled() && (needs.Get-TestResults.result == 'success' || needs.Get-TestResults.result == 'skipped') && (needs.Get-CodeCoverage.result == 'success' || needs.Get-CodeCoverage.result == 'skipped') && (needs.Build-Site.result == 'success' || needs.Build-Site.result == 'skipped')
237257
uses: ./.github/workflows/Publish-Module.yml
238-
secrets: inherit
258+
secrets:
259+
APIKey: ${{ secrets.APIKey }}
239260
needs:
240261
- Get-Settings
241262
- Get-TestResults

0 commit comments

Comments
 (0)