-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Check GH token availability for Get-Changelog #25133
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
Conversation
tools/releaseTools.psm1
Outdated
$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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$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) { |
tools/releaseTools.psm1
Outdated
@@ -361,6 +368,30 @@ function Get-ChangeLog | |||
Write-Output "[${version}]: https://github.com/PowerShell/PowerShell/compare/${LastReleaseTag}...${ThisReleaseTag}`n" | |||
} | |||
|
|||
function CheckForAuthToken { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function CheckForAuthToken { | |
function Get-GHDefaultAuthToken { |
tools/releaseTools.psm1
Outdated
[string]$Token, | ||
|
||
[Parameter()] | ||
[switch]$HasCherryPick | ||
) | ||
|
||
if(-not $Token) { | ||
$Token = CheckForAuthToken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$Token = CheckForAuthToken | |
$Token = Get-GHDefaultAuthToken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review comments
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
📣 Hey @jshigetomi, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
Co-authored-by: Justin Chung <chungjustin@microsoft.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Co-authored-by: Justin Chung <chungjustin@microsoft.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
PR Summary
This pull request includes changes to the
tools/releaseTools.psm1
file to improve the handling of GitHub authentication tokens in theGet-ChangeLog
function. The most important changes include making theToken
parameter optional and adding a new function to check for an authentication token.Improvements to GitHub token handling:
Token
parameter inGet-ChangeLog
to be optional instead of mandatory.CheckForAuthToken
function that checks for an existing GitHub CLI token or prompts the user to enter one if not found.Get-ChangeLog
to callCheckForAuthToken
if theToken
parameter is not provided, ensuring a token is available for GitHub API requests.PR Context
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed:
(which runs in a different PS Host).