Action-Test - [ #] by @MariusStorhaug #41
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' | |
| 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-percent-target/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' |