Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ on:
APIKey:
description: The API key for the PowerShell Gallery.
required: true
TEST_APP_CLIENT_ID:
description: The client ID of an app for running tests.
TEST_APP_ENT_CLIENT_ID:
description: The client ID of an Enterprise GitHub App for running tests.
required: false
TEST_APP_PRIVATE_KEY:
description: The private key of an app for running tests.
TEST_APP_ENT_PRIVATE_KEY:
description: The private key of an Enterprise GitHub App for running tests.
required: false
TEST_FG_ORG_PAT:
TEST_APP_ORG_CLIENT_ID:
description: The client ID of an Organization GitHub App for running tests.
required: false
TEST_APP_ORG_PRIVATE_KEY:
description: The private key of an Organization GitHub App for running tests.
required: false
TEST_USER_ORG_FG_PAT:
description: The fine-grained personal access token with org access for running tests.
required: false
TEST_FG_USER_PAT:
TEST_USER_USER_FG_PAT:
description: The fine-grained personal access token with user account access for running tests.
required: false
TEST_PAT:
TEST_USER_PAT:
description: The classic personal access token for running tests.
required: false
inputs:
Expand Down Expand Up @@ -78,11 +84,13 @@ on:

env:
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }}
TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }}
TEST_FG_ORG_PAT: ${{ secrets.TEST_FG_ORG_PAT }}
TEST_FG_USER_PAT: ${{ secrets.TEST_FG_USER_PAT }}
TEST_PAT: ${{ secrets.TEST_PAT }}
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}

permissions:
contents: read # to checkout the repository
Expand Down
32 changes: 20 additions & 12 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ on:
APIKey:
description: The API key for the PowerShell Gallery.
required: true
TEST_APP_CLIENT_ID:
description: The client ID of an app for running tests.
TEST_APP_ENT_CLIENT_ID:
description: The client ID of an Enterprise GitHub App for running tests.
required: false
TEST_APP_PRIVATE_KEY:
description: The private key of an app for running tests.
TEST_APP_ENT_PRIVATE_KEY:
description: The private key of an Enterprise GitHub App for running tests.
required: false
TEST_FG_ORG_PAT:
TEST_APP_ORG_CLIENT_ID:
description: The client ID of an Organization GitHub App for running tests.
required: false
TEST_APP_ORG_PRIVATE_KEY:
description: The private key of an Organization GitHub App for running tests.
required: false
TEST_USER_ORG_FG_PAT:
description: The fine-grained personal access token with org access for running tests.
required: false
TEST_FG_USER_PAT:
TEST_USER_USER_FG_PAT:
description: The fine-grained personal access token with user account access for running tests.
required: false
TEST_PAT:
TEST_USER_PAT:
description: The classic personal access token for running tests.
required: false
inputs:
Expand Down Expand Up @@ -83,11 +89,13 @@ on:

env:
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }}
TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }}
TEST_FG_ORG_PAT: ${{ secrets.TEST_FG_ORG_PAT }}
TEST_FG_USER_PAT: ${{ secrets.TEST_FG_USER_PAT }}
TEST_PAT: ${{ secrets.TEST_PAT }}
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}

permissions:
contents: write # to checkout the repo and create releases on the repo
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ in the workflow file.
| ---- | -------- | ----------- | ------- |
| `GITHUB_TOKEN` | `github` context | The token used to authenticate with GitHub. | `${{ secrets.GITHUB_TOKEN }}` |
| `APIKey` | GitHub secrets | The API key for the PowerShell Gallery. | N/A |
| `TEST_APP_CLIENT_ID` | GitHub secrets | The client ID of an app for running tests. | N/A |
| `TEST_APP_PRIVATE_KEY` | GitHub secrets | The private key of an app for running tests. | N/A |
| `TEST_FG_ORG_PAT` | GitHub secrets | The fine-grained personal access token with org access for running tests. | N/A |
| `TEST_FG_USER_PAT` | GitHub secrets | The fine-grained personal access token with user account access for running tests. | N/A |
| `TEST_PAT` | GitHub secrets | The classic personal access token for running tests. | N/A |
| `TEST_APP_ENT_CLIENT_ID` | GitHub secrets | The client ID of an Enterprise GitHub App for running tests. | N/A |
| `TEST_APP_ENT_PRIVATE_KEY` | GitHub secrets | The private key of an Enterprise GitHub App for running tests. | N/A |
| `TEST_APP_ORG_CLIENT_ID` | GitHub secrets | The client ID of an Organization GitHub App for running tests. | N/A |
| `TEST_APP_ORG_PRIVATE_KEY` | GitHub secrets | The private key of an Organization GitHub App for running tests. | N/A |
| `TEST_USER_ORG_FG_PAT` | GitHub secrets | The fine-grained personal access token with org access for running tests. | N/A |
| `TEST_USER_USER_FG_PAT` | GitHub secrets | The fine-grained personal access token with user account access for running tests. | N/A |
| `TEST_USER_PAT` | GitHub secrets | The classic personal access token for running tests. | N/A |

## Permissions

Expand Down
11 changes: 9 additions & 2 deletions tests/tests/PSModuleTest.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ Param(
)

Write-Verbose "Path to the module: [$Path]" -Verbose

Describe 'Environment Variables are available' {
It 'Should be available [<_>]' -ForEach @('TEST_APP_CLIENT_ID', 'TEST_APP_PRIVATE_KEY', 'TEST_FG_ORG_PAT', 'TEST_FG_USER_PAT', 'TEST_PAT') {
It 'Should be available [<_>]' -ForEach @(
'TEST_APP_ENT_CLIENT_ID',
'TEST_APP_ENT_PRIVATE_KEY',
'TEST_APP_ORG_CLIENT_ID',
'TEST_APP_ORG_PRIVATE_KEY',
'TEST_USER_ORG_FG_PAT',
'TEST_USER_USER_FG_PAT',
'TEST_USER_PAT'
) {
$name = $_
Write-Verbose "Environment variable: [$name]" -Verbose
Get-ChildItem env: | Where-Object { $_.Name -eq $name } | Should -Not -BeNullOrEmpty
Expand Down