Skip to content

Convert .ci build/test pipelines from Azure DevOps to GitHub Actions - #2018

Open
adityapatwardhan wants to merge 5 commits into
PowerShell:masterfrom
adityapatwardhan:convert-ci-to-github-actions
Open

Convert .ci build/test pipelines from Azure DevOps to GitHub Actions#2018
adityapatwardhan wants to merge 5 commits into
PowerShell:masterfrom
adityapatwardhan:convert-ci-to-github-actions

Conversation

@adityapatwardhan

Copy link
Copy Markdown
Member

Summary

Converts the portable CI + test Azure DevOps pipelines under .ci/ to GitHub Actions. Original .ci files are left in place (no deletions).

New workflow Converted from Purpose
.github/workflows/psresourceget-ci.yml .ci/ci.yml (Build + Test stages) Builds the module .nupkg on windows-latest, uploads artifacts, then fans out to the test workflow
.github/workflows/psresourceget-test.yml .ci/test.yml (reusable template) Reusable (workflow_call) cross-platform test job

Test matrix (mirrors ci.yml)

  • PowerShell Core on Windows
  • Windows PowerShell on Windows
  • PowerShell Core on Ubuntu
  • PowerShell Core on macOS
  • AzAuth PowerShell Core on Windows (useAzAuth: true)

Key mapping decisions

  • Triggers: push + pull_request on master.
  • Azure auth: AzurePowerShell@5 / NuGetAuthenticate@1 -> azure/login@v2 + azure/powershell@v2 using OIDC / federated credentials (recommended - no long-lived secrets).
  • Artifacts: ADO artifact.upload / DownloadBuildArtifacts -> actions/upload-artifact@v4 / actions/download-artifact@v4.
  • $(Agent.TempDirectory) -> AGENT_TEMPDIRECTORY env set from $RUNNER_TEMP so carried-over scripts run unchanged.
  • DSC install / functional tests logic preserved verbatim.

Intentionally NOT converted

Signing (ESRP), Compliance (ComplianceRepo templates), Release, and Publish-Symbols stages rely on Microsoft-internal infrastructure (ESRP, 1ES secure pools, Microsoft symbol server, ADO artifact feeds) with no GitHub-hosted equivalent. ci_auto.yml, ci_release.yml, release.yml, publishsymbols.yml are unchanged.

Validation

  • Both workflows pass actionlint (exit 0) and YAML parse checks.

Required GitHub.com settings (repo Settings)

These must be configured for the Azure-authenticated / functional test jobs to succeed:

1. Azure OIDC federated credentials - create an App Registration / Managed Identity federated to this repo (subject repo:PowerShell/PSResourceGet:ref:refs/heads/master and the pull_request subject), grant it access to the PSResourceGetACR subscription / psresourcegettest ACR. Then add repository secrets:

  • AZURE_CLIENT_ID
  • AZURE_TENANT_ID
  • AZURE_SUBSCRIPTION_ID

2. Test PAT secrets (from the ADO GithubTestingFeedCreds variable group):

  • GITHUB_PAT
  • ADO_PUBLIC_PAT
  • ADO_PRIVATE_PAT
  • ADO_PRIVATE_REPO_URL

3. Actions permissions: Settings -> Actions -> General -> allow workflows to run. Workflows only need contents: read + id-token: write (already declared).

4. (Optional) Branch protection: add the new checks (e.g. PowerShell Core on Windows, PowerShell Core on Ubuntu, etc.) as required status checks once a run has reported them.

Note: GITHUB_TOKEN used by the DSC-download step is the built-in token - no configuration needed.

adityapatwardhan and others added 5 commits July 22, 2026 11:00
Adds a PowerShell-based migration tool that scans .ps1/.psm1/.psd1 files
for PowerShellGet v2 cmdlet usage and converts them to PSResourceGet
equivalents using AST-based parsing.

Features:
- 25 cmdlet mappings (Find-Module → Find-PSResource, etc.)
- Parameter transformations (version ranges, renames, removals)
- Dry-run report mode and in-place apply with backups
- 30 Pester tests covering all conversion scenarios

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds ConvertTo-PSResourceGetString function and -InputScript parameter
to the entry-point script, enabling direct string-to-string conversion
without needing files on disk.

Usage:
  .\ConvertTo-PSResourceGet.ps1 -InputScript 'Install-Module -Name Pester'
  'Find-Module -Name Az' | .\ConvertTo-PSResourceGet.ps1

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merge PSGetMigration.psm1/psd1 module into ConvertTo-PSResourceGet.ps1
as a self-contained script. All functions are defined inline and the
main entry point is guarded so dot-sourcing for tests works correctly.

Removes: PSGetMigration.psm1, PSGetMigration.psd1

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
When -MinimumVersion or -MaximumVersion contains a variable reference
(e.g. \), use double quotes for the version range string
so the variable expands at runtime. Literal version strings continue to
use single quotes.

Before: -Version '(,\]'  (broken - no expansion)
After:  -Version "(,\]"  (correct - variable expands)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds GitHub Actions equivalents for the portable CI + test pipelines:
- .github/workflows/psresourceget-ci.yml  (from .ci/ci.yml build + test stages)
- .github/workflows/psresourceget-test.yml (reusable, from .ci/test.yml)

Azure-authenticated test steps use azure/login OIDC (federated credentials).
Signing, compliance, release and symbol stages are intentionally not converted
(Microsoft-internal ESRP / 1ES / ComplianceRepo / symbol server). Original .ci
files are kept unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ceb1570e-c42e-4363-8f8e-5abc7f750458
Copilot AI lite review requested due to automatic review settings August 4, 2026 21:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the repo’s portable CI/test pipelines from Azure DevOps (.ci/) to GitHub Actions by introducing a Windows build workflow that publishes artifacts and a reusable, cross-platform test workflow. It also adds a PSGet→PSResourceGet script migration tool (with docs and tests), which is additional scope beyond the PR’s stated CI-conversion focus.

Changes:

  • Add PSResourceGet-CI GitHub Actions workflow to build the module on Windows and upload artifacts.
  • Add reusable PSResourceGet-Test workflow (workflow_call) to run the existing cross-platform functional test logic.
  • Add a PSGet→PSResourceGet migration utility script under tool/migration/ with a README and Pester tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/psresourceget-ci.yml New CI workflow to build/package on Windows and fan out to the reusable test workflow.
.github/workflows/psresourceget-test.yml New reusable test workflow implementing the cross-platform functional test logic and Azure auth flow.
tool/migration/ConvertTo-PSResourceGet.ps1 New AST-based converter script for migrating PSGet v2 cmdlets/parameters to PSResourceGet equivalents.
tool/migration/README.md Documentation for the migration tool, usage patterns, and mapping tables.
tool/migration/Tests/PSGetMigration.Tests.ps1 Pester coverage for the converter mappings and conversion behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Many pwsh snippets below were carried over verbatim from the Azure DevOps template,
# which relied on $(Agent.TempDirectory). Map it to the runner temp directory so the
# scripts keep working unchanged across all subsequent steps.
"AGENT_TEMPDIRECTORY=$env:RUNNER_TEMP" | Out-File -FilePath $env:GITHUB_ENV -Append
Comment on lines +186 to +188
if ($parseErrors.Count -gt 0) {
Write-Warning "Parse errors in '$Path': $($parseErrors | ForEach-Object { $_.Message } | Join-String -Separator '; ')"
}
Comment thread tool/migration/README.md
## Using as a Module

```powershell
Import-Module .\tool\migration\PSGetMigration.psd1
Comment thread tool/migration/README.md
Comment on lines +1 to +5
# PSGet → PSResourceGet Migration Tool

A PowerShell-based tool to automatically migrate scripts from PowerShellGet v2 (PSGet)
cmdlets to their [PSResourceGet](https://github.com/PowerShell/PSResourceGet) equivalents.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants