Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

Updating Branch Snapping Workflow for New Versioning Scheme

Completed:

  • 1. Create helper function to calculate next release version (rounds up to nearest tens version)
  • 2. Add new gulp task for updating version on prerelease → release snap
  • 3. Update incrementVersion task to support release candidate flag
  • 4. Add unit tests for the new helper function
  • 5. Update GitHub workflow to support new versioning scheme
  • 6. Update documentation in CONTRIBUTING.md
  • 7. Verify and test all changes
  • 8. Address all code review feedback
  • 9. Add changelog automation for stable releases

Changes Made:

Latest Code Review Feedback Addressed:

  • Extracted changelog helper: Created addChangelogSection() helper function to eliminate duplication between tasks
  • Stable release changelog: updateVersionForStableRelease now automatically adds a changelog entry that references the prerelease version (e.g., "See 2.74.x for full list of changes")
  • Simplified incrementVersion logic: Rewrote to use clearer flow - if RC mode, get next stable version first, then increment from there
  • Removed workflow title: Removed title setting from create-pull-request action to allow default PR title

Previous Code Review Feedback Addressed:

  • Extracted helper functions: Created readVersionJson() and writeVersionJson() to eliminate duplication
  • Reduced duplication in incrementVersion: Refactored to use clearer logic flow
  • Renamed task: Changed updateVersionForRelease to updateVersionForStableRelease for clarity
  • Use create-pull-request action: Replaced manual git push with peter-evans/create-pull-request@v4 action in workflow

1. Helper Functions & Tasks (tasks/snapTasks.ts)

  • getNextReleaseVersion(): Rounds up minor version to next tens (e.g., 2.74 → 2.80)
  • readVersionJson(): Helper to read and parse version.json
  • writeVersionJson(): Helper to write version.json with consistent formatting
  • addChangelogSection(): Helper to add a new version section to the changelog (with optional additional lines)
  • updateVersionForStableRelease: Gulp task for prerelease → release snaps, now includes automatic changelog update with reference to prerelease
  • incrementVersion: Enhanced to accept --releaseCandidate flag with clear, simplified logic

2. GitHub Workflow (.github/workflows/branch-snap.yml)

  • Added releaseCandidate input parameter for workflow dispatch
  • Updated bump-main-version job to use the flag when provided
  • Updated update-release-version job to use create-pull-request action
  • Removed title setting to allow default PR title
  • Updated action versions to latest (checkout@v4)

3. Documentation (CONTRIBUTING.md)

  • Added "Versioning Scheme" section explaining the new rules
  • Updated snap instructions with details about the release candidate flag
  • Clarified version update behavior for each snap type

4. Test Infrastructure

  • Created comprehensive unit tests (10 test cases, all passing)
  • Added tasks test suite with proper jest configuration
  • Integrated into existing test infrastructure

Testing & Validation:

✅ All unit tests pass (492 total: 482 existing + 10 new)
✅ ESLint passes on all modified files
✅ TypeScript compilation successful
✅ YAML syntax validation passes
✅ Manual testing confirms correct behavior:

  • updateVersionForStableRelease: 2.74 → 2.80 with changelog entry ✓
  • incrementVersion: 2.74 → 2.75 with changelog entry ✓
  • incrementVersion --releaseCandidate=true: 2.74 → 2.81 with changelog entry ✓

Console Output Examples:

  • Normal: Updating 2.74 to 2.75
  • RC mode: Release candidate, using base version of 2.80 then Updating 2.74 to 2.81

Changelog Example for Stable Release:

# 2.80.x
* See 2.74.x for full list of changes.
Original prompt

I need to update the branch snapping workflow to align with a new versioning scheme. Currently we incrememnt the minor version in version.json every time we snap from main -> prerelease. The new versioning scheme will be different. The minor version should be incremented for every main -> prerelease snap, but stable releases (release branch) should get the next tens version. For example if the prerelease version was 2.74, then when it is snapped to release the version should become 2.80.

I believe we can accomplish this with the following changes

  1. Add a helper function (in /tasks) to determine the next release version given the current version in version.json.
  2. If snapping from prerelease -> release, we should take the branch created by the merge from prerelease to release (generally merge/prerelease-to-release) and push an update to the version.json to switch to the stable version to that branch. This would be handled by a new gulp task using the helper function in 1).
  3. When snapping from main -> prerelease, we add a new flag for if this is a releaseCandidate prerelease. If so, we know we need to update the version in main to be higher than the next stable version. e.g. if snapping 2.74 from main -> prerelease, the main version needs to become 2.81. The existing increment version gulp task should be updated to take in the flag and use the helper defined in 1) to get the next stable version and increment it by one.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Oct 28, 2025
Copilot AI and others added 3 commits October 28, 2025 21:16
Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com>
Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com>
Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com>
Copilot AI changed the title [WIP] Update branch snapping workflow for versioning scheme Implement tiered versioning scheme for branch snapping workflow Oct 28, 2025
Copilot finished work on behalf of dibarbet October 28, 2025 21:28
Copilot AI requested a review from dibarbet October 28, 2025 21:28
Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com>
Copilot finished work on behalf of dibarbet October 28, 2025 21:48
Copilot AI requested a review from dibarbet October 28, 2025 21:48
Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com>
Copilot finished work on behalf of dibarbet October 28, 2025 22:08
Copilot AI requested a review from dibarbet October 28, 2025 22:08
@dibarbet dibarbet marked this pull request as ready for review October 28, 2025 22:10
@dibarbet dibarbet requested a review from a team as a code owner October 28, 2025 22:10
Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com>
Copilot finished work on behalf of dibarbet October 29, 2025 18:31
Copilot AI requested a review from dibarbet October 29, 2025 18:31
@dibarbet
Copy link
Member

@dotnet-policy-service rerun

@dibarbet dibarbet merged commit 29c1583 into main Oct 30, 2025
28 checks passed
@dibarbet dibarbet deleted the copilot/update-versioning-scheme branch October 30, 2025 01:18
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.

3 participants