Skip to content

Honor the Run_ScriptBlock action input #82

Description

Context and request

Observed behavior: Run_ScriptBlock is transported from the workflow as a string and copied directly into Run.ScriptBlock. Pester 5.8.0 and 6.1.0 convert that string to an empty ScriptBlock[], so the supplied tests are discarded.

Expected behavior: A script block supplied through Run_ScriptBlock is executed, or an unsupported representation fails with a clear validation error.

Reproduction:

- uses: PSModule/Invoke-Pester@v3
  with:
    Run_ScriptBlock: |
      Describe 'inline tests' {
        It 'runs' { $true | Should -BeTrue }
      }

Environment: GitHub composite action with Pester 5.8.0 or 6.1.0.

Regression: Unknown. The declared action input appears not to have had a working scalar-to-script-block conversion.

Workaround: Put the test in a .Tests.ps1 file referenced by Path, or use a PowerShell configuration file containing a real script block.

Acceptance criteria

  • Add an action-level regression test that fails because the current input is discarded.
  • Convert the supported input representation to one or more ScriptBlock objects before creating the Pester configuration.
  • Verify the inline tests execute with supported Pester versions.
  • Document the accepted Run_ScriptBlock syntax and validation errors.

Technical decisions

The verified root cause is the scalar GitHub Action input crossing into a strongly typed Pester property without explicit conversion. Keep the correction limited to the action-input contract; configuration-file script blocks already retain their native type.

Implementation plan

  1. Add the failing action-level regression test.
  2. Define and validate the supported scalar representation.
  3. Convert it explicitly before merging the Pester configuration.
  4. Run the affected Pester 5 and Pester 6 action-test surfaces and update the input documentation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    github_actionsPull requests that update GitHub Actions code

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions