Skip to content

🩹 [Patch]: Action-Test workflow cannot be tested via schedule or workflow_dispatch events #268

@MariusStorhaug

Description

@MariusStorhaug

Problem

The Action-Test workflow, which uses the Publish-PSModule action, cannot be reliably triggered or tested using schedule or workflow_dispatch events. When triggered by these events, the workflow fails with the following error from the init.ps1 script:

Exception: /home/runner/work/Publish-PSModule/Publish-PSModule/scripts/init.ps1:82
Line |
 82 |          throw 'GitHub event does not contain pull_request data. This  …
    |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | GitHub event does not contain pull_request data. This script must be run
    | from a pull_request event.

Root Cause

The script expects the workflow to be triggered by a pull_request event and fails when event context is missing, as with scheduled or manual (workflow_dispatch) runs.

Expected Improvement

  • Refactor the workflow and/or the Publish-PSModule action to allow tests to be executed using schedule or workflow_dispatch events, e. g.:
    • Detect event type and skip PR-only logic when appropriate
    • Fall back to mock PR data for testing
    • Update docs to clarify which events can be used for testing

References

This issue affects scheduled runs in the Action-Test workflow that use the Publish-PSModule action.


Job context: Publish-PSModule/scripts/init.ps1:82 (ref)


Please investigate and propose a solution to make testability possible from all relevant workflow triggers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions