Skip to content

Allow Action-Test workflow to run from schedule and workflow_dispatch events #268

@MariusStorhaug

Description

Context

The Action-Test workflow is used to test actions like Publish-PSModule in CI. Currently, the workflow can only be triggered by pull_request events because the underlying init script expects PR context data.

Request

When the Action-Test workflow is triggered via schedule or workflow_dispatch events, it fails with:

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.

This prevents scheduled regression testing and manual test runs.

What is expected

The workflow and underlying actions should support execution from schedule and workflow_dispatch events in addition to pull_request. When PR context is unavailable, the action should either skip PR-specific logic or use sensible defaults.

Acceptance criteria

  • The Action-Test workflow can be triggered via schedule without errors
  • The Action-Test workflow can be triggered via workflow_dispatch without errors
  • PR-specific logic is skipped or uses defaults when PR context is unavailable
  • Existing pull_request-triggered behavior is unchanged

Technical decisions

To be determined during implementation planning.


Implementation plan

  • Identify all locations in Publish-PSModule/scripts/init.ps1 and related scripts that assume pull_request event context
  • Add event type detection to conditionally handle missing PR data
  • Define default/fallback behavior for non-PR triggers (e.g., skip PR comments, use HEAD branch)
  • Update the Action-Test workflow to include schedule and workflow_dispatch triggers
  • Test the workflow under all three trigger types

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions