Skip to content

[Eng] Fix parameterset name in publish-rmmodule #27814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 22, 2025
Merged

Conversation

VeryEarly
Copy link
Collaborator

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@Copilot Copilot AI review requested due to automatic review settings May 22, 2025 02:34
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

@Copilot Copilot AI left a comment

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 corrects parameter set handling in the Publish-RMModules function and standardizes tooling versions.

  • Added advanced function binding and a formal param() block to Get-ApiKey
  • Included the $ApiKey parameter in the “ByName” parameter set and guarded against empty values
  • Bumped Node.js versions in multiple Azure pipeline YAMLs from 18.20.7/14.17.1 to 18.20.8

Reviewed Changes

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

File Description
tools/ModulePublisher.psm1 Formalized Get-ApiKey as an advanced function; expanded parameter sets in Publish-RMModules and added empty-value guard for $ApiKey
.azure-pipelines/windows-powershell.yml Updated NodeTool versionSpec entries to 18.20.8
.azure-pipelines/powershell-core.yml Updated NodeTool versionSpec entries to 18.20.8
.azure-pipelines/azure-powershell-ci.yml Updated NodeTool versionSpec entries to 18.20.8

@@ -206,6 +210,7 @@ function Publish-RMModules
$RepoLocation,

[Parameter(ParameterSetName="ByLocation", Mandatory=$true)]
[Parameter(ParameterSetName="ByName", Mandatory=$false)]
Copy link
Preview

Copilot AI May 22, 2025

Choose a reason for hiding this comment

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

[nitpick] Since parameters default to non-mandatory, you can omit Mandatory=$false here to reduce redundancy and clarify that $ApiKey is optional in this set.

Suggested change
[Parameter(ParameterSetName="ByName", Mandatory=$false)]
[Parameter(ParameterSetName="ByName")]

Copilot uses AI. Check for mistakes.

@@ -221,7 +226,9 @@ function Publish-RMModules
if ($PSCmdlet.ParameterSetName -eq "ByName")
{
$RepoLocation = (Get-RepoLocation -repoName $RepoName)
$ApiKey = (Get-ApiKey -repoName $RepoName)
if ($null -eq $ApiKey -Or "" -eq $ApiKey) {
Copy link
Preview

Copilot AI May 22, 2025

Choose a reason for hiding this comment

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

To simplify and standardize null/empty checks, consider using [string]::IsNullOrEmpty($ApiKey) instead of separate comparisons.

Suggested change
if ($null -eq $ApiKey -Or "" -eq $ApiKey) {
if ([string]::IsNullOrEmpty($ApiKey)) {

Copilot uses AI. Check for mistakes.

@@ -43,7 +43,7 @@ jobs:
- task: NodeTool@0
displayName: Install Autorest
inputs:
versionSpec: '18.20.7'
versionSpec: '18.20.8'
Copy link
Preview

Copilot AI May 22, 2025

Choose a reason for hiding this comment

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

[nitpick] These literal version specs are duplicated across multiple pipeline files—extracting the Node.js version into a shared variable or template can reduce drift and simplify future updates.

Suggested change
versionSpec: '18.20.8'
versionSpec: ${{ variables.NodeJsVersion }}

Copilot uses AI. Check for mistakes.

@VeryEarly VeryEarly enabled auto-merge (squash) May 22, 2025 03:18
@VeryEarly VeryEarly merged commit e9d718b into main May 22, 2025
12 checks passed
@VeryEarly VeryEarly deleted the yabo/psgallery-publish branch May 22, 2025 03:27
msJinLei pushed a commit to msJinLei/azure-powershell that referenced this pull request May 23, 2025
msJinLei pushed a commit to msJinLei/azure-powershell that referenced this pull request May 23, 2025
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