Skip to content

Conversation

@jshigetomi
Copy link
Collaborator

@jshigetomi jshigetomi commented Mar 6, 2025

  • Check GH token availbility for Get-Changelog

PR Summary

This pull request includes changes to the tools/releaseTools.psm1 file to improve the handling of GitHub authentication tokens in the Get-ChangeLog function. The most important changes include making the Token parameter optional and adding a new function to check for an authentication token.

Improvements to GitHub token handling:

  • Modified the Token parameter in Get-ChangeLog to be optional instead of mandatory.
  • Added a new CheckForAuthToken function that checks for an existing GitHub CLI token or prompts the user to enter one if not found.
  • Updated Get-ChangeLog to call CheckForAuthToken if the Token parameter is not provided, ensuring a token is available for GitHub API requests.

PR Context

PR Checklist

@jshigetomi jshigetomi added the CL-Tools Indicates that a PR should be marked as a tools change in the Change Log label Mar 6, 2025
@jshigetomi jshigetomi marked this pull request as ready for review March 7, 2025 18:05
@jshigetomi jshigetomi requested a review from a team as a code owner March 7, 2025 18:05
Comment on lines 372 to 380
$IsGHCLIInstalled = $false
try {
& gh --version > $null 2>&1
$IsGHCLIInstalled = $true
} catch {
Write-Error -Message "GitHub CLI is not installed. Please install it from https://cli.github.com/"
}

if ($IsGHCLIInstalled) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$IsGHCLIInstalled = $false
try {
& gh --version > $null 2>&1
$IsGHCLIInstalled = $true
} catch {
Write-Error -Message "GitHub CLI is not installed. Please install it from https://cli.github.com/"
}
if ($IsGHCLIInstalled) {
$IsGHCLIInstalled = $false
if (Get-command -CommandType Application -Name gh -ErrorAction SilentlyContinue) {
$IsGHCLIInstalled = $true
} else {
Write-Error -Message "GitHub CLI is not installed. Please install it from https://cli.github.com/" -ErrorAction Stop
}
if ($IsGHCLIInstalled) {

Write-Output "[${version}]: https://github.com/PowerShell/PowerShell/compare/${LastReleaseTag}...${ThisReleaseTag}`n"
}

function CheckForAuthToken {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function CheckForAuthToken {
function Get-GHDefaultAuthToken {

)

if(-not $Token) {
$Token = CheckForAuthToken
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$Token = CheckForAuthToken
$Token = Get-GHDefaultAuthToken

Copy link
Member

@TravisEz13 TravisEz13 left a comment

Choose a reason for hiding this comment

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

review comments

@microsoft-github-policy-service microsoft-github-policy-service bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Mar 7, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Mar 7, 2025
@jshigetomi jshigetomi requested a review from TravisEz13 March 7, 2025 19:36
@jshigetomi
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@TravisEz13 TravisEz13 merged commit 14f8003 into master Mar 7, 2025
40 checks passed
@microsoft-github-policy-service
Copy link
Contributor

microsoft-github-policy-service bot commented Mar 7, 2025

📣 Hey @jshigetomi, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

jshigetomi added a commit that referenced this pull request Mar 12, 2025
Co-authored-by: Justin Chung <[email protected]>
Co-authored-by: Travis Plunk <[email protected]>
@TravisEz13 TravisEz13 deleted the UseGHCLIAuthToken branch March 24, 2025 17:54
pwshBot pushed a commit to pwshBot/PowerShell that referenced this pull request Apr 11, 2025
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BackPort-7.4.x-Done BackPort-7.5.x-Done CL-Tools Indicates that a PR should be marked as a tools change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants