The module exposes a workflow surface — Get-GitHubWorkflow, Start-GitHubWorkflow, Enable-GitHubWorkflow, Disable-GitHubWorkflow, and the run management functions in Workflows/Runs/ — but none of these are exercised in Actions.Tests.ps1. The current Actions tests cover only OIDC claims. The shared test repository is created with a README, a license, and a .gitignore, but contains no .github/workflows/ files, so the Workflow functions have no target to operate on.
Similarly, Artifacts.Tests.ps1 reads artifacts from $env:GITHUB_REPOSITORY_OWNER / $env:GITHUB_REPOSITORY_NAME (the PSModule/GitHub repository itself) and the current workflow run. This means artifact tests can only run inside the CI workflow — they silently have no data and likely fail when run locally or against the shared test repository.
Request
Desired capability
A set of version-controlled test fixture files in tests/Data/ that the shared test repository's BeforeAll seed into the repository via the GitHub API. Once seeded, the fixture content is stable and predictable, providing a reliable surface for testing workflow and content-related functions without relying on the live state of PSModule/GitHub itself.
The primary fixture is a workflow_dispatch-enabled GitHub Actions workflow. With this in the shared test repository, the following become testable against owned infrastructure:
Get-GitHubWorkflow — list and retrieve workflows by ID or filename
Enable-GitHubWorkflow / Disable-GitHubWorkflow — toggle state
Start-GitHubWorkflow — dispatch a run
Get-GitHubWorkflowRun / Stop-GitHubWorkflowRun / Restart-GitHubWorkflowRun / Remove-GitHubWorkflowRun — manage runs produced by the dispatched workflow
Secondary fixtures (simple text or binary files, a README, a nested directory structure) support testing file content APIs if those are added in future, and make the shared repository more representative of a real-world repository.
Acceptance criteria
tests/Data/ contains at least one workflow_dispatch-enabled workflow YAML file that can be committed into a test repository and triggered via Start-GitHubWorkflow.
tests/BeforeAll.ps1 (or the leaf test file BeforeAll) seeds the fixture files into the shared test repository using the module's own file-creation APIs, so the process exercises the module under test.
Actions.Tests.ps1 is expanded to cover Get-GitHubWorkflow, Enable-GitHubWorkflow, Disable-GitHubWorkflow, Start-GitHubWorkflow, and at least Get-GitHubWorkflowRun.
- Artifact tests no longer depend on the live state of
PSModule/GitHub or the current workflow run — they use artifacts produced by workflow runs dispatched against the shared test repository.
- All fixture-seeded content is idempotent (seeding the same files twice produces the same repository state).
- No test reads from
$env:GITHUB_REPOSITORY_OWNER / $env:GITHUB_REPOSITORY_NAME to access PSModule/GitHub itself as a data source.
Technical decisions
Fixture file location: tests/Data/Workflows/ for workflow YAML files. A single test-dispatch.yml is sufficient to start — a minimal workflow_dispatch workflow that does something verifiable (e.g., writes a step summary or creates a simple artifact). Additional fixtures can be added as further functions are tested.
Seeding mechanism: Use New-GitHubContent (or Set-GitHubContent if it exists) to commit each fixture file into the shared repository's .github/workflows/ path during BeforeAll. This exercises the module's content API as a side effect. Files are committed to the default branch so the workflow is immediately dispatchable. Because Set-* is idempotent, re-running BeforeAll on the same repository produces no duplicate commits.
Artifact test re-homing: Artifact tests should dispatch the test workflow (via Start-GitHubWorkflow) and wait for the run to produce an artifact, then assert against that artifact. Alternatively, if waiting for a run is too slow or unreliable, a pre-created artifact fixture could be uploaded directly via the GitHub API rather than produced by a real run — but this only tests the artifact retrieval side, not the full pipeline. The right scope is a discussion item.
BeforeAll vs. leaf BeforeAll: Seeding workflow files into the shared repository can happen in tests/BeforeAll.ps1 alongside repository creation (since workflows are repository-level fixtures, not per-test-run resources). This keeps the per-leaf BeforeAll lightweight. Alternatively, workflow seeding can live in Actions.Tests.ps1's per-context BeforeAll if tighter test isolation is preferred.
Workflow dispatch timing: Start-GitHubWorkflow returns immediately; the run appears in the API after a short delay. Tests that query runs after dispatch need a polling or wait strategy. Existing patterns in the module or test suite (if any) should be reused; if none exist, a small helper in tests/Data/ is appropriate.
Open: Whether to expand artifact tests to cover a full dispatch → run → artifact lifecycle, or scope this issue to workflow fixture seeding + workflow function coverage only, leaving artifact re-homing as a follow-up. The acceptance criteria above target the broader scope; this can be narrowed during planning.
Implementation plan
Fixture files
BeforeAll seeding
Actions.Tests.ps1 expansion
Artifacts.Tests.ps1 re-homing
Verification
The module exposes a workflow surface —
Get-GitHubWorkflow,Start-GitHubWorkflow,Enable-GitHubWorkflow,Disable-GitHubWorkflow, and the run management functions inWorkflows/Runs/— but none of these are exercised inActions.Tests.ps1. The current Actions tests cover only OIDC claims. The shared test repository is created with a README, a license, and a.gitignore, but contains no.github/workflows/files, so the Workflow functions have no target to operate on.Similarly,
Artifacts.Tests.ps1reads artifacts from$env:GITHUB_REPOSITORY_OWNER / $env:GITHUB_REPOSITORY_NAME(thePSModule/GitHubrepository itself) and the current workflow run. This means artifact tests can only run inside the CI workflow — they silently have no data and likely fail when run locally or against the shared test repository.Request
Desired capability
A set of version-controlled test fixture files in
tests/Data/that the shared test repository'sBeforeAllseed into the repository via the GitHub API. Once seeded, the fixture content is stable and predictable, providing a reliable surface for testing workflow and content-related functions without relying on the live state ofPSModule/GitHubitself.The primary fixture is a
workflow_dispatch-enabled GitHub Actions workflow. With this in the shared test repository, the following become testable against owned infrastructure:Get-GitHubWorkflow— list and retrieve workflows by ID or filenameEnable-GitHubWorkflow/Disable-GitHubWorkflow— toggle stateStart-GitHubWorkflow— dispatch a runGet-GitHubWorkflowRun/Stop-GitHubWorkflowRun/Restart-GitHubWorkflowRun/Remove-GitHubWorkflowRun— manage runs produced by the dispatched workflowSecondary fixtures (simple text or binary files, a
README, a nested directory structure) support testing file content APIs if those are added in future, and make the shared repository more representative of a real-world repository.Acceptance criteria
tests/Data/contains at least oneworkflow_dispatch-enabled workflow YAML file that can be committed into a test repository and triggered viaStart-GitHubWorkflow.tests/BeforeAll.ps1(or the leaf test fileBeforeAll) seeds the fixture files into the shared test repository using the module's own file-creation APIs, so the process exercises the module under test.Actions.Tests.ps1is expanded to coverGet-GitHubWorkflow,Enable-GitHubWorkflow,Disable-GitHubWorkflow,Start-GitHubWorkflow, and at leastGet-GitHubWorkflowRun.PSModule/GitHubor the current workflow run — they use artifacts produced by workflow runs dispatched against the shared test repository.$env:GITHUB_REPOSITORY_OWNER/$env:GITHUB_REPOSITORY_NAMEto accessPSModule/GitHubitself as a data source.Technical decisions
Fixture file location:
tests/Data/Workflows/for workflow YAML files. A singletest-dispatch.ymlis sufficient to start — a minimalworkflow_dispatchworkflow that does something verifiable (e.g., writes a step summary or creates a simple artifact). Additional fixtures can be added as further functions are tested.Seeding mechanism: Use
New-GitHubContent(orSet-GitHubContentif it exists) to commit each fixture file into the shared repository's.github/workflows/path duringBeforeAll. This exercises the module's content API as a side effect. Files are committed to the default branch so the workflow is immediately dispatchable. BecauseSet-*is idempotent, re-runningBeforeAllon the same repository produces no duplicate commits.Artifact test re-homing: Artifact tests should dispatch the test workflow (via
Start-GitHubWorkflow) and wait for the run to produce an artifact, then assert against that artifact. Alternatively, if waiting for a run is too slow or unreliable, a pre-created artifact fixture could be uploaded directly via the GitHub API rather than produced by a real run — but this only tests the artifact retrieval side, not the full pipeline. The right scope is a discussion item.BeforeAllvs. leafBeforeAll: Seeding workflow files into the shared repository can happen intests/BeforeAll.ps1alongside repository creation (since workflows are repository-level fixtures, not per-test-run resources). This keeps the per-leafBeforeAlllightweight. Alternatively, workflow seeding can live inActions.Tests.ps1's per-contextBeforeAllif tighter test isolation is preferred.Workflow dispatch timing:
Start-GitHubWorkflowreturns immediately; the run appears in the API after a short delay. Tests that query runs after dispatch need a polling or wait strategy. Existing patterns in the module or test suite (if any) should be reused; if none exist, a small helper intests/Data/is appropriate.Open: Whether to expand artifact tests to cover a full dispatch → run → artifact lifecycle, or scope this issue to workflow fixture seeding + workflow function coverage only, leaving artifact re-homing as a follow-up. The acceptance criteria above target the broader scope; this can be narrowed during planning.
Implementation plan
Fixture files
tests/Data/Workflows/test-dispatch.yml— a minimalworkflow_dispatchworkflow (e.g., writeshello from test-dispatchto$GITHUB_STEP_SUMMARY; optionally uploads a small artifact)BeforeAll seeding
tests/BeforeAll.ps1, after creating the shared repository, committest-dispatch.ymlto.github/workflows/test-dispatch.ymlusingNew-GitHubContent(orSet-GitHubContent)Get-GitHubWorkflowafter seedingActions.Tests.ps1 expansion
Get-GitHubWorkflow— list all workflows, retrieve by ID and by filenameEnable-GitHubWorkflow/Disable-GitHubWorkflow— verify state transitions and idempotencyStart-GitHubWorkflow— dispatch a run and confirm a run appears inGet-GitHubWorkflowRunGet-GitHubWorkflowRun— list runs, filter by workflow, retrieve by IDStop-GitHubWorkflowRun/Remove-GitHubWorkflowRun— at minimum, clean up runs created during testsArtifacts.Tests.ps1 re-homing
$Owner = $env:GITHUB_REPOSITORY_OWNER/$Repository = $env:GITHUB_REPOSITORY_NAMEwith the shared test repository owner and name$WorkflowRunId = $env:GITHUB_RUN_IDwith a run ID obtained from a dispatched test workflow run (or a pre-uploaded artifact if full dispatch is out of scope)Verification
Actions.Tests.ps1standalone (Invoke-Pester tests/Actions.Tests.ps1) against a populated shared test repository and confirm all new tests passArtifacts.Tests.ps1standalone and confirm it no longer depends onPSModule/GitHuborGITHUB_RUN_ID