Skip to content

Conversation

MariusStorhaug
Copy link
Member

Description

This pull request introduces several updates to improve functionality, maintainability, and configuration flexibility in the GitHub PowerShell module. The most significant changes include adding a new function to determine the GitHub environment type, enhancing context initialization with dynamic property updates, and introducing a configurable JWT time tolerance.

New functionality

  • Added the Get-GitHubEnvironmentType function to dynamically determine the environment type (e.g., GitHub Actions, Azure Functions, or local) based on environment variables. This replaces the previous static logic.

Enhancements to configuration handling

  • Updated the Initialize-GitHubConfig function to dynamically add missing default properties to the stored context, ensuring compatibility with future updates.
  • Introduced a new JwtTimeTolerance property in the GitHub.DefaultConfig object to allow configurable time tolerance for JSON Web Token (JWT) generation.

Refactoring

  • Replaced the static EnvironmentType logic in GitHub.ps1 with a call to the new Get-GitHubEnvironmentType function for better modularity and maintainability.

Improvements to JWT handling

  • Updated JWT generation in Get-GitHubAppJSONWebToken to use the new JwtTimeTolerance property for both issued-at (iat) and expiration (exp) times, improving flexibility and time slip.

Dependency management

  • Added a #Requires statement to Set-GitHubSecret to ensure the required Sodium module is available, improving reliability.

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 May 3, 2025
@Copilot Copilot AI review requested due to automatic review settings May 3, 2025 10:18
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner May 3, 2025 10:18
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 introduces several enhancements including dynamic configuration updates and improved JWT handling along with dependency management improvements.

  • Added a configurable JwtTimeTolerance property for JWT generation
  • Enhanced configuration handling in the GitHub PowerShell module by dynamically updating context properties
  • Updated dependency management, including a new #Requires statement for the Sodium module
Files not reviewed (5)
  • src/functions/private/Config/Get-GitHubEnvironmentType.ps1: Language not supported
  • src/functions/private/Config/Initialize-GitHubConfig.ps1: Language not supported
  • src/functions/public/Apps/GitHub App/Get-GitHubAppJSONWebToken.ps1: Language not supported
  • src/functions/public/Secrets/Set-GitHubSecret.ps1: Language not supported
  • src/variables/private/GitHub.ps1: Language not supported

@MariusStorhaug MariusStorhaug merged commit 14307bc into main May 3, 2025
10 checks passed
@MariusStorhaug MariusStorhaug deleted the cleanup branch May 3, 2025 18:23
@github-project-automation github-project-automation bot moved this from Todo to Done in GitHub PowerShell Module May 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2025

Module GitHub - 0.27.1 published to the PowerShell Gallery.

@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2025

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