Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

Addresses feedback on PR #1095 regarding uninitialized RELEASE_TYPE variable when LATEST_TAG is empty or null.

Changes

  • Initialize RELEASE_TYPE = "preminor" at script start (line 48) before tag retrieval
  • Ensures valid output to GITHUB_OUTPUT at line 127 in all code paths

Context

Without initialization, fresh repositories with no tags or failed tag retrieval would leave RELEASE_TYPE undefined:

# Before: RELEASE_TYPE only set inside conditionals
$LATEST_TAG = git tag -l --sort=-version:refname | Select-Object -First 1
if ($LATEST_TAG -like "*-*") {
    $RELEASE_TYPE = "prerelease"
} else {
    $RELEASE_TYPE = "preminor"
}
# If LATEST_TAG is empty, RELEASE_TYPE remains uninitialized

# After: Default value guarantees valid output
$RELEASE_TYPE = "preminor"  # Safe default
$LATEST_TAG = git tag -l --sort=-version:refname | Select-Object -First 1
# Conditionals update if tag exists, otherwise default is used

Default of "preminor" is appropriate for first prerelease version creation.


💡 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 in the docs.

Copilot AI changed the title [WIP] Address feedback on nightly build PR check and logging improvements Add default initialization for RELEASE_TYPE to handle edge cases Dec 16, 2025
Copilot AI requested a review from Romanitho December 16, 2025 12:37
@Romanitho Romanitho marked this pull request as ready for review December 16, 2025 12:38
Copilot AI review requested due to automatic review settings December 16, 2025 12:38
@Romanitho Romanitho merged commit b28f7a8 into fix/nightlies Dec 16, 2025
2 checks passed
@Romanitho Romanitho deleted the copilot/sub-pr-1095 branch December 16, 2025 12:38
Copy link
Contributor

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 adds defensive initialization for the RELEASE_TYPE variable to ensure it always has a valid value before being written to GITHUB_OUTPUT. The change sets a default value of "preminor" at the beginning of the script, which is appropriate for creating the first prerelease version.

Key Changes:

  • Added default initialization $RELEASE_TYPE = "preminor" at line 48, immediately before tag retrieval
  • Ensures valid output is written to GITHUB_OUTPUT at line 130 in all code paths

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.

2 participants