Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PSModule/GitHub
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.36.7
Choose a base ref
...
head repository: PSModule/GitHub
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.36.8
Choose a head ref
  • 1 commit
  • 10 files changed
  • 3 contributors

Commits on Sep 6, 2025

  1. 🩹 [Patch]: Align all formats that show data size (#498)

    This PR standardizes how size-related properties are handled across all
    GitHub classes to ensure consistency in storage format and display
    formatting.
    
    ## Changes Made
    
    ### 1. GitHubRepository
    - **Property**: Updated `Size` property to store bytes instead of
    kilobytes
    - **Storage**: Convert API values using `$Object.size * 1KB` and
    `$Object.diskUsage * 1KB`
    - **Display**: Updated format file to use
    `[GitHubFormatter]::FormatFileSize($_.Size)`
    - **Documentation**: Updated comments to reflect "in bytes" instead of
    "in kilobytes"
    
    ### 2. GitHubOrganization
    - **Property**: Renamed `DiskUsage` property to `Size` for consistency
    - **Storage**: Convert API values using `$Object.disk_usage * 1KB` 
    - **Compatibility**: Added `DiskUsage` alias property for backward
    compatibility
    - **Documentation**: Updated comments to reflect "size of organization's
    repositories, in bytes"
    
    ### 3. GitHubArtifact
    - **Display**: Updated format file to use
    `[GitHubFormatter]::FormatFileSize($_.Size)` instead of custom
    formatting
    - **Property**: Already correctly stores bytes and uses "Size" property
    name
    - **Label**: Updated table header from "Size (KB)" to "Size" for cleaner
    display
    
    ### 4. Format File Updates
    All affected format files now use the standardized
    `[GitHubFormatter]::FormatFileSize()` method instead of custom size
    calculations, ensuring consistent human-readable formatting across all
    size displays.
    
    ### 5. Comprehensive Test Coverage
    - **GitHubFormatter.Tests.ps1**: New test file validating unit
    conversion logic (KB→bytes), type boundaries, and format patterns
    - **Enhanced Integration Tests**: Added size property validation tests
    to Repositories.Tests.ps1, Organizations.Tests.ps1, and
    Artifacts.Tests.ps1
    - **Unit Verification**: Tests confirm all size properties store values
    in bytes and use expected denominations
    - **Compatibility Testing**: Validates DiskUsage alias functionality and
    backward compatibility
    
    ## Verification
    
    The changes maintain backward compatibility and existing functionality:
    - Size conversions work correctly: 108 KB → 110,592 bytes → "108.00 KB"
    display
    - Tests continue to pass (they only verify `Size > 0`)
    - New tests verify correct unit storage and formatting behavior
    - GitHubReleaseAsset was already implemented correctly as the reference
    standard
    
    ## Example Impact
    
    Before:
    ```powershell
    # GitHubRepository.Size = 108 (kilobytes)
    # Display: "0.11 MB" (custom calculation)
    
    # GitHubOrganization.DiskUsage = 10000 (kilobytes)  
    # Display: Not shown in table format
    ```
    
    After:
    ```powershell
    # GitHubRepository.Size = 110592 (bytes)
    # Display: "108.00 KB" (standardized formatter)
    
    # GitHubOrganization.Size = 10240000 (bytes)
    # GitHubOrganization.DiskUsage -> Size (alias for compatibility)
    # Display: "9.77 MB" (standardized formatter)
    ```
    
    Fixes #478.
    
    <!-- START COPILOT CODING AGENT TIPS -->
    ---
    
    💡 You can make Copilot smarter by setting up custom instructions,
    customizing its development environment and configuring Model Context
    Protocol (MCP) servers. Learn more [Copilot coding agent
    tips](https://gh.io/copilot-coding-agent-tips) in the docs.
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
    Co-authored-by: Marius Storhaug <marstor@hotmail.com>
    3 people authored Sep 6, 2025
    Configuration menu
    Copy the full SHA
    89c27cd View commit details
    Browse the repository at this point in the history
Loading