Skip to content

Dispatch: Feature PR Workflow #15

Dispatch: Feature PR Workflow

Dispatch: Feature PR Workflow #15

name: 'Dispatch: Feature PR Workflow'
on:
workflow_dispatch:
inputs:
node-version:
description: Node.js version to use.
required: false
type: choice
options:
- '18'
- '20'
- '22'
- '24'
default: '24'
debug:
description: Enable debug logging.
required: false
type: choice
default: 'false'
options:
- 'true'
- 'false'
jobs:
log-context:
name: Log GitHub Context
runs-on: ubuntu-latest
if: ${{ inputs.debug == 'true' }}
steps:
- name: GitHub Context JSON
shell: pwsh
run: |
$json = '${{ toJSON(github) }}'
Write-Host "GitHub Context`n`n$($json)" -BackgroundColor DarkYellow -foregroundColor Black
- name: GitHub Context (Table)
shell: pwsh
run: |
function Output-Object($obj, $title = 'Root Level (github)') {
Write-Information "$title"
Write-Information ("-" * $title.Length)
$props = $obj.PSObject.Properties
if ($null -eq $obj -or $null -eq $props -or $props.Length -eq 0) {
Write-Warning "No properties found in $title.`n"
return
}
$props | Sort-Object Name | Format-Table Name,Value -AutoSize
}
function Explore-Object($obj, $parentTitle = 'github') {
foreach ($prop in $obj.PSObject.Properties) {
if ($prop.Value -is [System.Management.Automation.PSObject]) {
Output-Object $prop.Value "$($parentTitle).$($prop.Name)"
Explore-Object $prop.Value "$($parentTitle).$($prop.Name)"
}
}
}
$context = '${{ toJSON(github) }}' | ConvertFrom-Json
Output-Object $context
Explore-Object $context
test:
name: Unit Testing
uses: WJSoftware/cicd/.github/workflows/npm-test.yml@v0.4
secrets: inherit
with:
node-version: ${{ inputs.node-version }}
build-script: ${{ inputs.debug == 'true' && 'build:debug' || 'build' }}