Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 8, 2025

This PR improves code clarity by renaming misleading variable names in API parameter hashtables throughout the codebase.

Problem

Previously, the variable $inputObject was used to represent hashtables containing parameters for API requests. However, $inputObject typically implies pipeline input rather than API request parameters, making it confusing and misleading for developers maintaining the code.

Example of confusing usage:

$inputObject = @{
    Method      = 'DELETE'
    APIEndpoint = "/orgs/$Name"
    Context     = $Context
}

Invoke-GitHubAPI @inputObject

Solution

Renamed all occurrences of $inputObject used specifically for API request parameter hashtables to $apiParams for clarity and better readability.

After the change:

$apiParams = @{
    Method      = 'DELETE'
    APIEndpoint = "/orgs/$Name"
    Context     = $Context
}

Invoke-GitHubAPI @apiParams

Changes Made

  • Files Modified: 211 files total
  • REST API calls: 202 files with Invoke-GitHubAPI @inputObjectInvoke-GitHubAPI @apiParams
  • GraphQL calls: 9 files with Invoke-GitHubGraphQLQuery @inputObjectInvoke-GitHubGraphQLQuery @apiParams
  • Lines Changed: 595 insertions, 595 deletions (pure variable renaming)

Scope

Changed: All occurrences where $inputObject explicitly represents parameters passed to Invoke-GitHubAPI or Invoke-GitHubGraphQLQuery

Preserved: Parameters named $InputObject intended for pipeline input objects (such as [Parameter(ValueFromPipeline)])

Validation

  • All PowerShell syntax validation passes
  • Pipeline parameters correctly preserved (e.g., [GitHubVariable[]] $InputObject in Remove-GitHubVariable)
  • Zero remaining $inputObject variables used with API calls
  • No functional changes - pure variable renaming

Outcome

Improved code clarity and maintainability, reducing potential confusion for future development and maintenance by clearly distinguishing API parameter hashtables from pipeline input parameters.

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 🩹 [Patch]: Rename $inputObject variables to $apiParams in API calls 🩹 [Patch]: Rename $inputObject variables to $apiParams in API calls Jul 8, 2025
@Copilot Copilot AI requested a review from MariusStorhaug July 8, 2025 12:27
Copilot finished work on behalf of MariusStorhaug July 8, 2025 12:27
@MariusStorhaug MariusStorhaug marked this pull request as ready for review July 8, 2025 12:47
@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 12:47
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner July 8, 2025 12:47
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

Improve clarity by renaming the hashtable variable used for API request parameters from $inputObject to $apiParams across all PowerShell modules.

  • Rename $inputObject to $apiParams in API and GraphQL call contexts
  • Update Invoke-GitHubAPI and Invoke-GitHubGraphQLQuery invocations to use the new variable
  • Preserve pipeline‐bound $InputObject parameters elsewhere

Reviewed Changes

Copilot reviewed 211 out of 211 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/functions/public/Workflows/Start-GitHubWorkflow.ps1 Renamed $inputObject to $apiParams in dispatch
src/functions/public/Workflows/Runs/Stop-GitHubWorkflowRun.ps1 Updated cancellation call to use $apiParams
src/functions/public/Workflows/Runs/Restart-GitHubWorkflowRun.ps1 Renamed parameter hashtable for rerun invocation
src/functions/public/API/Invoke-GitHubGraphQLQuery.ps1 Updated GraphQL query invocation to use $apiParams
… (renames across 211 files for other API modules) Consistent variable renaming in all modules

@MariusStorhaug MariusStorhaug merged commit 12288bd into main Jul 8, 2025
11 checks passed
@MariusStorhaug MariusStorhaug deleted the copilot/fix-433 branch July 8, 2025 17:41
@github-project-automation github-project-automation bot moved this from Todo to Done in GitHub PowerShell Module Jul 8, 2025
Copy link
Contributor

github-actions bot commented Jul 8, 2025

Module GitHub - 0.33.10 published to the PowerShell Gallery.

Copy link
Contributor

github-actions bot commented Jul 8, 2025

GitHub release for GitHub v0.33.10 has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🩹 [Patch]: Rename $inputObject variables to $apiParams in API calls
2 participants