Action-Test - [🌟[Major] Introducing Get-PSModuleSettings GitHub Action #1] by @MariusStorhaug #34
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Action-Test | |
| run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| ActionTestValid: | |
| name: Action-Test - [Valid Configuration] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Need to check out as part of the test, as its a local action | |
| - name: Checkout repo | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Action-Test | |
| id: get-settings | |
| uses: ./ | |
| with: | |
| SettingsPath: './tests/scenarios/valid/PSModule.yml' | |
| - name: Verify Action Succeeded | |
| shell: pwsh | |
| env: | |
| SETTINGS_JSON: ${{ steps.get-settings.outputs.Settings }} | |
| run: | | |
| if ([string]::IsNullOrEmpty($env:SETTINGS_JSON)) { | |
| Write-Error 'Action failed to produce settings output' | |
| exit 1 | |
| } | |
| Write-Host '✓ Action executed successfully and produced valid output' | |
| # Verify the output is valid JSON | |
| try { | |
| $settings = $env:SETTINGS_JSON | ConvertFrom-Json | |
| Write-Host "✓ Settings output is valid JSON with Name: $($settings.Name)" | |
| } catch { | |
| Write-Error "Settings output is not valid JSON: $_" | |
| exit 1 | |
| } | |
| ActionTestInvalidMissingTestConfig: | |
| name: Action-Test - [Invalid - Missing Test Config] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Need to check out as part of the test, as its a local action | |
| - name: Checkout repo | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Action-Test (Expect Failure) | |
| id: get-settings | |
| continue-on-error: true | |
| uses: ./ | |
| with: | |
| SettingsPath: './tests/scenarios/invalid-missing-test-config/PSModule.yml' | |
| - name: Verify Action Failed as Expected | |
| shell: pwsh | |
| run: | | |
| if ('${{ steps.get-settings.outcome }}' -eq 'success') { | |
| Write-Error 'Expected action to fail for invalid configuration, but it succeeded' | |
| exit 1 | |
| } | |
| Write-Host '✓ Action failed as expected for invalid configuration' |