Skip to content

🪲 [Fix]: Skip revoke token if token is expired #488

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

Merged
merged 4 commits into from
Aug 6, 2025

Conversation

MariusStorhaug
Copy link
Member

Description

This pull request refactors the conditional logic in the Disconnect-GitHubAccount function to improve readability and debugging and that actually skips the revocation of the token if it is expired.

Refactoring and debugging improvements:

  • Added a condition to check if the token is expired before running the Revoke-GitHubAppInstallationAccessToken. The issue here was that the function would fail if it was expired.
  • Split the previous compound conditional into three distinct variables: $isNotGitHubToken, $isIATAuthType, and $isNotExpired for clarity and maintainability.
  • Added Write-Debug statements for each condition to facilitate easier troubleshooting and understanding of the script's flow.

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

…token expiration before revoking access token
…` to check for token type and expiration before revoking access
@MariusStorhaug MariusStorhaug self-assigned this Aug 6, 2025
@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 08:11
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner August 6, 2025 08:11
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 PR fixes a bug in the Disconnect-GitHubAccount function where token revocation was attempted even when the token was expired, causing failures. The fix adds a check to skip revocation for expired tokens and improves code readability through refactoring.

  • Added expiration check to prevent revoking expired tokens
  • Refactored compound conditional into separate variables for better maintainability
  • Added debug statements to improve troubleshooting capabilities

@MariusStorhaug MariusStorhaug merged commit 2dff5b7 into main Aug 6, 2025
47 of 69 checks passed
@MariusStorhaug MariusStorhaug deleted the fixDisconnectExpiredIAT branch August 6, 2025 10:33
@github-project-automation github-project-automation bot moved this from Todo to Done in GitHub PowerShell Module Aug 6, 2025
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Module GitHub - 0.36.2 published to the PowerShell Gallery.

Copy link
Contributor

github-actions bot commented Aug 6, 2025

GitHub release for GitHub v0.36.2 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.

1 participant