Skip to content

Commit 3d63d83

Browse files
🩹 [Patch]: Add new secrets that the 'CI' and 'workflow' can handle (#70)
## Description This pull request includes updates to the environment variables used in the GitHub Actions workflows and corresponding documentation. The changes primarily involve renaming and adding new environment variables for different types of GitHub Apps and tokens. ### Updates to environment variables: * [`.github/workflows/CI.yml`](diffhunk://#diff-3ab46ee209a127470fce3c2cf106b1a1dbadbb929a4b5b13656a4bc4ce19c0b8L9-R27): Renamed and added new environment variables for Enterprise and Organization GitHub Apps, as well as fine-grained personal access tokens. [[1]](diffhunk://#diff-3ab46ee209a127470fce3c2cf106b1a1dbadbb929a4b5b13656a4bc4ce19c0b8L9-R27) [[2]](diffhunk://#diff-3ab46ee209a127470fce3c2cf106b1a1dbadbb929a4b5b13656a4bc4ce19c0b8L81-R93) * [`.github/workflows/workflow.yml`](diffhunk://#diff-126bf89616b7daa3d14ebc882ad18666aaf1c3dae888c4ba306a66ec80758bc1L9-R27): Made similar updates to environment variables for GitHub Apps and tokens as in `CI.yml`. [[1]](diffhunk://#diff-126bf89616b7daa3d14ebc882ad18666aaf1c3dae888c4ba306a66ec80758bc1L9-R27) [[2]](diffhunk://#diff-126bf89616b7daa3d14ebc882ad18666aaf1c3dae888c4ba306a66ec80758bc1L86-R98) ### Documentation updates: * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L94-R100): Updated the list of environment variables to reflect the new names and additions for GitHub Apps and tokens. ### Test updates: * [`tests/tests/PSModuleTest.Tests.ps1`](diffhunk://#diff-08780d45f860f48bf959e30a0dd51be9defa0a61999bac6d9f45822e97b701d8L9-R18): Updated the test script to check for the availability of the new environment variables. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [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 32a2cb3 commit 3d63d83

File tree

4 files changed

+56
-31
lines changed

4 files changed

+56
-31
lines changed

.github/workflows/CI.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ on:
66
APIKey:
77
description: The API key for the PowerShell Gallery.
88
required: true
9-
TEST_APP_CLIENT_ID:
10-
description: The client ID of an app for running tests.
9+
TEST_APP_ENT_CLIENT_ID:
10+
description: The client ID of an Enterprise GitHub App for running tests.
1111
required: false
12-
TEST_APP_PRIVATE_KEY:
13-
description: The private key of an app for running tests.
12+
TEST_APP_ENT_PRIVATE_KEY:
13+
description: The private key of an Enterprise GitHub App for running tests.
1414
required: false
15-
TEST_FG_ORG_PAT:
15+
TEST_APP_ORG_CLIENT_ID:
16+
description: The client ID of an Organization GitHub App for running tests.
17+
required: false
18+
TEST_APP_ORG_PRIVATE_KEY:
19+
description: The private key of an Organization GitHub App for running tests.
20+
required: false
21+
TEST_USER_ORG_FG_PAT:
1622
description: The fine-grained personal access token with org access for running tests.
1723
required: false
18-
TEST_FG_USER_PAT:
24+
TEST_USER_USER_FG_PAT:
1925
description: The fine-grained personal access token with user account access for running tests.
2026
required: false
21-
TEST_PAT:
27+
TEST_USER_PAT:
2228
description: The classic personal access token for running tests.
2329
required: false
2430
inputs:
@@ -78,11 +84,13 @@ on:
7884

7985
env:
8086
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
81-
TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }}
82-
TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }}
83-
TEST_FG_ORG_PAT: ${{ secrets.TEST_FG_ORG_PAT }}
84-
TEST_FG_USER_PAT: ${{ secrets.TEST_FG_USER_PAT }}
85-
TEST_PAT: ${{ secrets.TEST_PAT }}
87+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
88+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
89+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
90+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
91+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
92+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
93+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
8694

8795
permissions:
8896
contents: read # to checkout the repository

.github/workflows/workflow.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ on:
66
APIKey:
77
description: The API key for the PowerShell Gallery.
88
required: true
9-
TEST_APP_CLIENT_ID:
10-
description: The client ID of an app for running tests.
9+
TEST_APP_ENT_CLIENT_ID:
10+
description: The client ID of an Enterprise GitHub App for running tests.
1111
required: false
12-
TEST_APP_PRIVATE_KEY:
13-
description: The private key of an app for running tests.
12+
TEST_APP_ENT_PRIVATE_KEY:
13+
description: The private key of an Enterprise GitHub App for running tests.
1414
required: false
15-
TEST_FG_ORG_PAT:
15+
TEST_APP_ORG_CLIENT_ID:
16+
description: The client ID of an Organization GitHub App for running tests.
17+
required: false
18+
TEST_APP_ORG_PRIVATE_KEY:
19+
description: The private key of an Organization GitHub App for running tests.
20+
required: false
21+
TEST_USER_ORG_FG_PAT:
1622
description: The fine-grained personal access token with org access for running tests.
1723
required: false
18-
TEST_FG_USER_PAT:
24+
TEST_USER_USER_FG_PAT:
1925
description: The fine-grained personal access token with user account access for running tests.
2026
required: false
21-
TEST_PAT:
27+
TEST_USER_PAT:
2228
description: The classic personal access token for running tests.
2329
required: false
2430
inputs:
@@ -83,11 +89,13 @@ on:
8389

8490
env:
8591
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
86-
TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }}
87-
TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }}
88-
TEST_FG_ORG_PAT: ${{ secrets.TEST_FG_ORG_PAT }}
89-
TEST_FG_USER_PAT: ${{ secrets.TEST_FG_USER_PAT }}
90-
TEST_PAT: ${{ secrets.TEST_PAT }}
92+
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
93+
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
94+
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
95+
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
96+
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
97+
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
98+
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
9199

92100
permissions:
93101
contents: write # to checkout the repo and create releases on the repo

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ in the workflow file.
9191
| ---- | -------- | ----------- | ------- |
9292
| `GITHUB_TOKEN` | `github` context | The token used to authenticate with GitHub. | `${{ secrets.GITHUB_TOKEN }}` |
9393
| `APIKey` | GitHub secrets | The API key for the PowerShell Gallery. | N/A |
94-
| `TEST_APP_CLIENT_ID` | GitHub secrets | The client ID of an app for running tests. | N/A |
95-
| `TEST_APP_PRIVATE_KEY` | GitHub secrets | The private key of an app for running tests. | N/A |
96-
| `TEST_FG_ORG_PAT` | GitHub secrets | The fine-grained personal access token with org access for running tests. | N/A |
97-
| `TEST_FG_USER_PAT` | GitHub secrets | The fine-grained personal access token with user account access for running tests. | N/A |
98-
| `TEST_PAT` | GitHub secrets | The classic personal access token for running tests. | N/A |
94+
| `TEST_APP_ENT_CLIENT_ID` | GitHub secrets | The client ID of an Enterprise GitHub App for running tests. | N/A |
95+
| `TEST_APP_ENT_PRIVATE_KEY` | GitHub secrets | The private key of an Enterprise GitHub App for running tests. | N/A |
96+
| `TEST_APP_ORG_CLIENT_ID` | GitHub secrets | The client ID of an Organization GitHub App for running tests. | N/A |
97+
| `TEST_APP_ORG_PRIVATE_KEY` | GitHub secrets | The private key of an Organization GitHub App for running tests. | N/A |
98+
| `TEST_USER_ORG_FG_PAT` | GitHub secrets | The fine-grained personal access token with org access for running tests. | N/A |
99+
| `TEST_USER_USER_FG_PAT` | GitHub secrets | The fine-grained personal access token with user account access for running tests. | N/A |
100+
| `TEST_USER_PAT` | GitHub secrets | The classic personal access token for running tests. | N/A |
99101

100102
## Permissions
101103

tests/tests/PSModuleTest.Tests.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ Param(
66
)
77

88
Write-Verbose "Path to the module: [$Path]" -Verbose
9-
109
Describe 'Environment Variables are available' {
11-
It 'Should be available [<_>]' -ForEach @('TEST_APP_CLIENT_ID', 'TEST_APP_PRIVATE_KEY', 'TEST_FG_ORG_PAT', 'TEST_FG_USER_PAT', 'TEST_PAT') {
10+
It 'Should be available [<_>]' -ForEach @(
11+
'TEST_APP_ENT_CLIENT_ID',
12+
'TEST_APP_ENT_PRIVATE_KEY',
13+
'TEST_APP_ORG_CLIENT_ID',
14+
'TEST_APP_ORG_PRIVATE_KEY',
15+
'TEST_USER_ORG_FG_PAT',
16+
'TEST_USER_USER_FG_PAT',
17+
'TEST_USER_PAT'
18+
) {
1219
$name = $_
1320
Write-Verbose "Environment variable: [$name]" -Verbose
1421
Get-ChildItem env: | Where-Object { $_.Name -eq $name } | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)