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
20 changes: 20 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ name: Process-PSModule - CI

on:
workflow_call:
secrets:
APIKey:
description: The API key to use when publishing modules
required: true
TEST_APP_CLIENT_ID:
description: The client ID for the test application
required: false
TEST_APP_PRIVATE_KEY:
description: The private key for the test application
required: false
TEST_FG_PAT:
description: The personal access token for the test application
required: false
TEST_PAT:
description: The personal access token for the test application
required: false
inputs:
Name:
type: string
Expand Down Expand Up @@ -49,6 +65,10 @@ 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_PAT: ${{ secrets.TEST_FG_PAT }}
TEST_PAT: ${{ secrets.TEST_PAT }}

permissions:
contents: read # to checkout the repository
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ on:
APIKey:
description: The API key to use when publishing modules
required: true
TEST_APP_CLIENT_ID:
description: The client ID for the test application
required: false
TEST_APP_PRIVATE_KEY:
description: The private key for the test application
required: false
TEST_FG_PAT:
description: The personal access token for the test application
required: false
TEST_PAT:
description: The personal access token for the test application
required: false
inputs:
Name:
type: string
Expand Down Expand Up @@ -58,6 +70,10 @@ 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_PAT: ${{ secrets.TEST_FG_PAT }}
TEST_PAT: ${{ secrets.TEST_PAT }}

permissions:
contents: write # to checkout the repo and create releases on the repo
Expand Down Expand Up @@ -446,6 +462,12 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Initialize environment
uses: PSModule/Initialize-PSModule@v1
with:
Version: ${{ inputs.Version }}
Prerelease: ${{ inputs.Prerelease }}

- name: Download docs artifact
uses: actions/download-artifact@v4
with:
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@ jobs:

### Secrets

The following secrets are **required** for the workflow to run:
The following secrets are used by the workflow. They can be automatically provided (if available) by setting the `secrets: inherit`
in the workflow file.

| Name | Location | Description | Default |
| ---- | -------- | ----------- | ------- |
| `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 for running tests. | N/A |
| `TEST_APP_PRIVATE_KEY` | GitHub secrets | The private key for running tests. | N/A |
| `TEST_FG_PAT` | GitHub secrets | The fine-grained personal access token for running tests. | N/A |
| `TEST_PAT` | GitHub secrets | The classic personal access token for running tests. | N/A |

## Permissions

Expand Down
8 changes: 8 additions & 0 deletions tests/tests/PSModuleTest.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ 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_PAT', 'TEST_PAT') {
$name = $_
Write-Verbose "Environment variable: [$name]" -Verbose
Get-ChildItem env: | Where-Object { $_.Name -eq $name } | Should -Not -BeNullOrEmpty
}
}

Describe 'PSModuleTest.Tests.ps1' {
Context 'Function: Test-PSModuleTest' {
It 'Should be able to call the function' {
Expand Down