Skip to content

Commit 32a2cb3

Browse files
🩹 [Patch]: Add new personal access tokens for organization and user account (#69)
## Description This pull request includes updates to the 'CI' and 'workflow' workflow config, environment variables, and documentation to allow it to handle two Fine-grained access tokens. Updates to 'CI' and 'workflow' workflow configuration: * [`.github/workflows/CI.yml`](diffhunk://#diff-3ab46ee209a127470fce3c2cf106b1a1dbadbb929a4b5b13656a4bc4ce19c0b8L7-R22): Updated descriptions for `APIKey`, `TEST_APP_CLIENT_ID`, `TEST_APP_PRIVATE_KEY`, and `TEST_PAT`. Added new secrets `TEST_FG_ORG_PAT` and `TEST_FG_USER_PAT` for fine-grained personal access tokens with org and user account access respectively. * [`.github/workflows/CI.yml`](diffhunk://#diff-3ab46ee209a127470fce3c2cf106b1a1dbadbb929a4b5b13656a4bc4ce19c0b8L80-R84): Updated environment variables to include `TEST_FG_ORG_PAT` and `TEST_FG_USER_PAT`. Documentation updates: * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L94-R97): Updated descriptions for `TEST_APP_CLIENT_ID`, `TEST_APP_PRIVATE_KEY`, `TEST_FG_ORG_PAT`, `TEST_FG_USER_PAT`, and `TEST_PAT` to reflect changes in the workflow configuration. Test updates: * [`tests/tests/PSModuleTest.Tests.ps1`](diffhunk://#diff-08780d45f860f48bf959e30a0dd51be9defa0a61999bac6d9f45822e97b701d8L11-R11): Updated the list of environment variables to include `TEST_FG_ORG_PAT` and `TEST_FG_USER_PAT`. ## 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 44008be commit 32a2cb3

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

.github/workflows/CI.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ on:
44
workflow_call:
55
secrets:
66
APIKey:
7-
description: The API key to use when publishing modules
7+
description: The API key for the PowerShell Gallery.
88
required: true
99
TEST_APP_CLIENT_ID:
10-
description: The client ID for the test application
10+
description: The client ID of an app for running tests.
1111
required: false
1212
TEST_APP_PRIVATE_KEY:
13-
description: The private key for the test application
13+
description: The private key of an app for running tests.
1414
required: false
15-
TEST_FG_PAT:
16-
description: The personal access token for the test application
15+
TEST_FG_ORG_PAT:
16+
description: The fine-grained personal access token with org access for running tests.
17+
required: false
18+
TEST_FG_USER_PAT:
19+
description: The fine-grained personal access token with user account access for running tests.
1720
required: false
1821
TEST_PAT:
19-
description: The personal access token for the test application
22+
description: The classic personal access token for running tests.
2023
required: false
2124
inputs:
2225
Name:
@@ -77,7 +80,8 @@ env:
7780
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
7881
TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }}
7982
TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }}
80-
TEST_FG_PAT: ${{ secrets.TEST_FG_PAT }}
83+
TEST_FG_ORG_PAT: ${{ secrets.TEST_FG_ORG_PAT }}
84+
TEST_FG_USER_PAT: ${{ secrets.TEST_FG_USER_PAT }}
8185
TEST_PAT: ${{ secrets.TEST_PAT }}
8286

8387
permissions:

.github/workflows/workflow.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ on:
44
workflow_call:
55
secrets:
66
APIKey:
7-
description: The API key to use when publishing modules
7+
description: The API key for the PowerShell Gallery.
88
required: true
99
TEST_APP_CLIENT_ID:
10-
description: The client ID for the test application
10+
description: The client ID of an app for running tests.
1111
required: false
1212
TEST_APP_PRIVATE_KEY:
13-
description: The private key for the test application
13+
description: The private key of an app for running tests.
1414
required: false
15-
TEST_FG_PAT:
16-
description: The personal access token for the test application
15+
TEST_FG_ORG_PAT:
16+
description: The fine-grained personal access token with org access for running tests.
17+
required: false
18+
TEST_FG_USER_PAT:
19+
description: The fine-grained personal access token with user account access for running tests.
1720
required: false
1821
TEST_PAT:
19-
description: The personal access token for the test application
22+
description: The classic personal access token for running tests.
2023
required: false
2124
inputs:
2225
Name:
@@ -82,7 +85,8 @@ env:
8285
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
8386
TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }}
8487
TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }}
85-
TEST_FG_PAT: ${{ secrets.TEST_FG_PAT }}
88+
TEST_FG_ORG_PAT: ${{ secrets.TEST_FG_ORG_PAT }}
89+
TEST_FG_USER_PAT: ${{ secrets.TEST_FG_USER_PAT }}
8690
TEST_PAT: ${{ secrets.TEST_PAT }}
8791

8892
permissions:

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ 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 for running tests. | N/A |
95-
| `TEST_APP_PRIVATE_KEY` | GitHub secrets | The private key for running tests. | N/A |
96-
| `TEST_FG_PAT` | GitHub secrets | The fine-grained personal access token for running tests. | 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 |
9798
| `TEST_PAT` | GitHub secrets | The classic personal access token for running tests. | N/A |
9899

99100
## Permissions

tests/tests/PSModuleTest.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Param(
88
Write-Verbose "Path to the module: [$Path]" -Verbose
99

1010
Describe 'Environment Variables are available' {
11-
It 'Should be available [<_>]' -ForEach @('TEST_APP_CLIENT_ID', 'TEST_APP_PRIVATE_KEY', 'TEST_FG_PAT', 'TEST_PAT') {
11+
It 'Should be available [<_>]' -ForEach @('TEST_APP_CLIENT_ID', 'TEST_APP_PRIVATE_KEY', 'TEST_FG_ORG_PAT', 'TEST_FG_USER_PAT', 'TEST_PAT') {
1212
$name = $_
1313
Write-Verbose "Environment variable: [$name]" -Verbose
1414
Get-ChildItem env: | Where-Object { $_.Name -eq $name } | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)