-
Notifications
You must be signed in to change notification settings - Fork 4
🩹 [Patch]: Add a dynamically format property for GitHubContext
#449
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
…te formatting for display
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.
Pull Request Overview
This pull request adds a dynamic property "Remaining" to both InstallationGitHubContext and UserGitHubContext, and updates the display format to include a new "Remaining" column that shows the token expiration countdown in a visually enhanced manner.
- Added a computed "Remaining" property that calculates the time span until token expiration.
- Updated the formatting file to include a new table column with color-coded output based on the remaining time.
- Implemented conditional formatting logic based on token type to adjust visual indicators appropriately.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/types/GitHubContext.Types.ps1xml | Added dynamic property "Remaining" to GitHub context types. |
src/formats/GitHubContext.Format.ps1xml | Added a new table column and script logic to display the "Remaining" time with color-coded output. |
Comments suppressed due to low confidence (1)
src/formats/GitHubContext.Format.ps1xml:69
- Consider adding a default case in the switch statement to handle unexpected AuthType values, ensuring that $MaxValue is always set to a defined value.
switch ($_.AuthType) {
…ntext types and update related formatting
…bContext and UserGitHubContext definitions
…RemainingTime' in GitHubContext display
GitHubContext
with expirationGitHubContext
…es from PSCustomObject
30aa0f0
to
f0169a1
Compare
…HubContext and UserGitHubContext to be nullable
…Remaining' property is defined in both UserGitHubContext and InstallationGitHubContext
Module GitHub - 0.33.1-formatExpiration001 published to the PowerShell Gallery. |
GitHub release for GitHub v0.33.1-formatExpiration001 has been created. |
Module GitHub - 0.33.1 published to the PowerShell Gallery. |
GitHub release for GitHub v0.33.1 has been created. |
Description
This pull request introduces a new
Remaining
property to GitHub context types and updates the display format to show the time remaining until token expiration. The changes improve the clarity and usability of token expiration information by providing both textual and color-coded visual indicators.Enhancements to GitHub context display:
Remaining
in the table display:src/formats/GitHubContext.Format.ps1xml
to include aRemaining
column header and display logic for the time remaining until token expiration. The display uses a color-coded system based on the ratio of remaining time to the maximum allowed duration, enhancing visual clarity. [1] [2]GitHub context types improvements:
Remaining
property for token expiration:Remaining
script property to bothInstallationGitHubContext
andUserGitHubContext
types insrc/types/GitHubContext.Types.ps1xml
. This property calculates the time span between the current date and the token expiration date, enabling the new display functionality.Type of change
Checklist