Skip to content

Conversation

MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented Jul 1, 2025

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:

  • Added a new column for Remaining in the table display:
    • Updated src/formats/GitHubContext.Format.ps1xml to include a Remaining 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:

  • Introduced the Remaining property for token expiration:
    • Added a Remaining script property to both InstallationGitHubContext and UserGitHubContext types in src/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

  • 📖 [Docs]
  • 🪲 [Fix]
  • 🩹 [Patch]
  • ⚠️ [Security fix]
  • 🚀 [Feature]
  • 🌟 [Breaking change]

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@MariusStorhaug MariusStorhaug self-assigned this Jul 1, 2025
@Copilot Copilot AI review requested due to automatic review settings July 1, 2025 11:39
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner July 1, 2025 11:39
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 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) {

@MariusStorhaug MariusStorhaug changed the title 🩹 [Patch]: Add a dynamically property 'Remaining' for GitHubContext with expiration 🩹 [Patch]: Add a dynamically format property for GitHubContext Jul 1, 2025
…HubContext and UserGitHubContext to be nullable
…Remaining' property is defined in both UserGitHubContext and InstallationGitHubContext
Copy link
Contributor

github-actions bot commented Jul 1, 2025

Module GitHub - 0.33.1-formatExpiration001 published to the PowerShell Gallery.

Copy link
Contributor

github-actions bot commented Jul 1, 2025

GitHub release for GitHub v0.33.1-formatExpiration001 has been created.

@MariusStorhaug MariusStorhaug merged commit 1b4773a into main Jul 1, 2025
11 checks passed
@MariusStorhaug MariusStorhaug deleted the formatExpiration branch July 1, 2025 18:05
@github-project-automation github-project-automation bot moved this from Todo to Done in GitHub PowerShell Module Jul 1, 2025
Copy link
Contributor

github-actions bot commented Jul 1, 2025

Module GitHub - 0.33.1 published to the PowerShell Gallery.

Copy link
Contributor

github-actions bot commented Jul 1, 2025

GitHub release for GitHub v0.33.1 has been created.

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

Successfully merging this pull request may close these issues.

🩹 [Patch]: Color the token expiration date in contexts based on validity
1 participant