Skip to content

Conversation

Copy link

Copilot AI commented Sep 5, 2025

This PR fixes the New-Release.GitHub.build.ps1 task to use the actual built commit instead of the latest main branch commit, adds comprehensive DryRun support, improves the GitVersion configuration while maintaining backward compatibility, pins GitVersion to version 5.* for consistent builds, and updates the build workflow configuration.

Key Changes

Build Script Improvements

  • Added BuildCommit parameter: Allows explicit specification of the commit to create releases from, with support for -BuildCommit parameter, BUILDCOMMIT environment variable, and PowerShell session variable
  • CI-aware commit detection: Automatically detects commit SHA from GitHub Actions (GITHUB_SHA) or Azure Pipelines (BUILD_SOURCEVERSION)
  • Backward-compatible fallback: When BuildCommit is not provided and no CI environment variables are available, defaults to origin/$MainGitBranch to preserve the original behavior
  • Added DryRun parameter: Provides simulation mode following established Sampler patterns, showing what would be done without making changes
  • Refactored logic: Eliminated code duplication by merging BuildCommit resolution with existing source hint logic

GitVersion Configuration

  • Improved regex patterns: Updated feature branch regex to use ^f(eature(s)?)?[\/-] for more precise matching
  • Enhanced hotfix pattern: Added (hot)?fix(es)?[\/-] regex for better hotfix branch detection
  • Cleaned up configuration: Removed duplicate commented sections for better maintainability

Pipeline Improvements

  • Pinned GitVersion.Tool: Set to version 5.* in Azure Pipelines for consistent builds and avoiding breaking changes from major version updates
  • Added DryRun support: Added DryRun environment variable to publishRelease step for simulation mode
  • Updated build workflow: Modified publish workflow in build.yaml to prioritize GitHub releases and prepare for future module publishing by commenting out gallery publishing and wiki content tasks

Code Quality

  • Eliminated duplication: Merged redundant commit resolution logic
  • Improved maintainability: DryRun messages are now placed directly next to their corresponding commands
  • Consistent messaging: Informational actions display consistently regardless of DryRun mode
  • Fixed error messages: Updated error message to correctly reference the actual git command used

The implementation follows established patterns from gaelcolas/Sampler and provides a clean, maintainable solution for GitHub release automation while ensuring no breaking changes to existing workflows.

Changes Made

  • Added BuildCommit parameter with CI-aware commit detection
  • Added DryRun parameter following Sampler patterns
  • Refactored BuildCommit resolution logic to eliminate duplication
  • Updated GitVersion.yml with improved regex patterns for feature and hotfix branches
  • Pinned GitVersion.Tool to version 5.* in Azure Pipelines
  • Added DryRun support to Azure Pipelines publishRelease step
  • Updated build.yaml publish workflow configuration
  • Removed unnecessary DryRun messages for non-state-changing actions
  • Fixed error message to reference correct git command
  • Added changelog entries following keepachangelog format
  • Ensured backward compatibility by defaulting to origin/$MainGitBranch
  • Removed BUILDCOMMIT environment variable from resolution order and updated error message

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…e commit resolution

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copilot AI changed the title [WIP] @gaelcolas/Sampler.GitHubTasks/files/.build/tasks/New-Release.GitHub.build.ps1 In this line we need to make sure it is using the actual commit being used as per issue: @gaelcolas/Sampler/issues/538 We should implement similar functionality as in PR @... Fix New-Release.GitHub.build.ps1 to use actual built commit instead of branch HEAD Sep 5, 2025
Copilot AI requested a review from johlju September 5, 2025 05:00
- Move commit SHA resolution logic from parameter default into task body to reduce duplication
- Merge commit resolution with source hint determination logic
- Add DryRun parameter to simulate release creation without performing actual operations
- Follow same pattern as Create_Release_Git_Tag task from Sampler repository
- Add comprehensive DryRun logging showing what would be performed

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copy link
Author

Copilot AI commented Sep 5, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.powershellgallery.com
    • Triggering command: pwsh -File build.ps1 -ResolveDependency -Tasks noop (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Fix New-Release.GitHub.build.ps1 to use actual built commit instead of branch HEAD Fix New-Release.GitHub.build.ps1 to use actual built commit with DryRun support and refactored logic Sep 5, 2025
Copilot AI requested a review from johlju September 5, 2025 05:28
Copy link
Collaborator

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add a entry to the changelog according to keepachangelog format

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copy link
Author

Copilot AI commented Sep 5, 2025

@copilot add a entry to the changelog according to keepachangelog format

Added changelog entries following keepachangelog format. Added entries under "Added" section for the new BuildCommit and DryRun parameters, and under "Changed" section for the commit resolution fix. See commit db946f1.

Copilot AI requested a review from johlju September 5, 2025 05:46
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
@johlju
Copy link
Collaborator

johlju commented Sep 5, 2025

@copilot Update GitVersion.yml with these regular expressions:

  feature:
    tag: useBranchName
    increment: Minor
    regex: ^f(eature(s)?)?[\/-]
    source-branches: ['master']
  hotfix:
    tag: fix
    increment: Patch
    regex: (hot)?fix(es)?[\/-]
    source-branches: ['master']

…nd hotfix branches

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copy link
Author

Copilot AI commented Sep 5, 2025

@copilot Update GitVersion.yml with these regular expressions:

...

Updated GitVersion.yml with the requested regular expressions. Added ^ prefix to the feature branch regex and cleaned up the duplicate commented sections. See commit 0abbc2c.

@johlju
Copy link
Collaborator

johlju commented Sep 5, 2025

@copilot in build.yaml on line 63-66 change the key publish: to:

  publish:
    - Publish_Release_To_GitHub
    #- Publish_Module_To_gallery
    #- Publish_GitHub_Wiki_Content 

It is very important that the commented line remain as they will be uncommented in a later PR.

- Change publish workflow to use Publish_Release_To_GitHub only
- Comment out Publish_Module_To_gallery for later uncomment
- Add commented Publish_GitHub_Wiki_Content for later uncomment
- Remove Create_ChangeLog_GitHub_PR task

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copy link
Author

Copilot AI commented Sep 5, 2025

@copilot in build.yaml on line 63-66 change the key publish: to:

...

Updated build.yaml to modify the publish workflow configuration as requested. Changed to use only Publish_Release_To_GitHub as active task, commented out Publish_Module_To_gallery and Publish_GitHub_Wiki_Content for later uncomment, and removed Create_ChangeLog_GitHub_PR. See commit 2e91f32.

Copilot AI changed the title Fix New-Release.GitHub.build.ps1 to use actual built commit with DryRun support, backward-compatible GitVersion configuration, and pinned GitVersion v5 Fix New-Release.GitHub.build.ps1 to use actual built commit with DryRun support, backward-compatible GitVersion configuration, pinned GitVersion v5, and updated build workflow Sep 5, 2025
@johlju johlju requested a review from Copilot September 5, 2025 10:18

This comment was marked as outdated.

@johlju johlju changed the title Fix New-Release.GitHub.build.ps1 to use actual built commit with DryRun support, backward-compatible GitVersion configuration, pinned GitVersion v5, and updated build workflow Publish_release_to_GitHub: Uses actual built commit for release Sep 5, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
johlju
johlju previously requested changes Sep 5, 2025
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
…ate error message

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
@johlju johlju requested a review from Copilot September 5, 2025 10:41
@johlju johlju marked this pull request as ready for review September 5, 2025 10:42
Copy link

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 the Publish_release_to_GitHub task to use the actual built commit instead of the latest main branch commit, adds comprehensive DryRun support, and improves GitVersion configuration while maintaining backward compatibility.

  • Added BuildCommit parameter with CI-aware commit detection that automatically resolves from GitHub Actions, Azure Pipelines, or falls back to origin/main
  • Added DryRun parameter to simulate release creation without making changes, following established Sampler patterns
  • Updated GitVersion configuration with improved regex patterns and pinned GitVersion.Tool to version 5.* for consistent builds

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.build/tasks/New-Release.GitHub.build.ps1 Added BuildCommit and DryRun parameters with CI-aware commit resolution logic
azure-pipelines.yml Pinned GitVersion.Tool to version 5.* and added DryRun environment variable
build.yaml Updated publish workflow to prioritize GitHub releases and commented out gallery publishing
GitVersion.yml Improved regex patterns for feature branches and removed duplicate commented sections
CHANGELOG.md Added changelog entries documenting the new features and fixes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@johlju
Copy link
Collaborator

johlju commented Sep 5, 2025

I'm merging this to see how it dogfood itself when using DryRun. If it looks good I will send in a new PR that switches back all tasks and removes DryRun.

@johlju johlju dismissed their stale review September 5, 2025 10:47

It is myself and I will fix any problems that arises

@johlju
Copy link
Collaborator

johlju commented Sep 5, 2025

@gaelcolas I can't override the review, I need help to approve this one 🙂

@raandree
Copy link

@gaelcolas, please consider #26 after merging this PR.

@gaelcolas
Copy link
Owner

@johlju can you double validate that you're disabling the publish?

Copy link
Owner

@gaelcolas gaelcolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with the changes.
I find the AI review spamming the comment section...

Before merging, @johlju please make sure you're still ok to disable the publish from the build.yaml

Copy link
Owner

@gaelcolas gaelcolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with the changes.
I find the AI review spamming the comment section...

Before merging, @johlju please make sure you're still ok to disable the publish from the build.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants