Skip to content

Conversation

Copy link

Copilot AI commented Jan 25, 2026

Merge version scripts and update nightly tag

Investigation Complete

  • Locate and review set_version.py and set_nightly_version.py in pio-scripts/
  • Understand how scripts are called in platformio.ini
  • Understand nightly build flow via GitHub workflows

Changes Implemented

  • Merge set_version.py and set_nightly_version.py into single script
  • Update version tag handling: transform to "-nightly" for nightly builds only
  • Update platformio.ini to reference only one script
  • Remove old set_nightly_version.py file
  • Test the merged script logic
  • Refactor code structure per code review feedback
  • Improve multi-hyphen version handling
  • Revert package.json to keep original "-mdev" tag (per feedback)
  • Remove redundant -mdev check (simplified logic)
  • Make environment variable check more robust (accepts 'true', '1', 'yes' case-insensitive)

How It Works

  • Non-nightly builds: Uses version from package.json as-is
  • Nightly builds: Transforms version tag at build time
    • Environment check: Accepts 'true', '1', 'yes' (case-insensitive)
    • If version has a tag (contains -): Replace last segment with -nightly
    • If no tag: Append -nightly

Validation Complete

  • All 16 npm tests pass successfully
  • Script execution verified for both nightly and non-nightly modes
  • Tested with multiple version formats (14.7.2, 14.7.2-beta, 14.7.8-mdev)
  • Code simplified to remove redundant check
  • Environment variable check handles multiple true values
Original prompt
  • merge set_version.py and set_nightly_version.py into one file
  • changer the version tag of nightly build from "-mdev" into "-nightly", or append "-nightly" if no tag was present

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Summary by CodeRabbit

  • Refactor
    • Consolidated nightly build version handling into the core build system script for streamlined build process management.

✏️ Tip: You can customize this high-level summary in your review settings.

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
@softhack007
Copy link
Collaborator

softhack007 commented Jan 25, 2026

@copilot The content of "package.json" should not be changed. I only want the "-nightly" tag to be used for nightly CI builds, but all other builds should use the version from"package.json" as before.

Copilot AI and others added 2 commits January 25, 2026 17:52
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Copilot AI changed the title [WIP] Merge set_version and set_nightly_version scripts Merge version scripts and change nightly tag from -mdev to -nightly Jan 25, 2026
Copilot AI requested a review from softhack007 January 25, 2026 17:55
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 25, 2026

@copilot The content of "package.json" should not be changed. I only want the "-nightly" tag to be used for nightly CI builds, but all other builds should use the version from"package.json" as before.

Done. Reverted package.json to keep the original "-mdev" tag. The script now only transforms the version tag during nightly CI builds, leaving the source file unchanged.

  • Non-nightly builds: Use "14.7.2-mdev" from package.json as-is
  • Nightly builds: Transform to "14.7.2-nightly" at build time only

Commit: 16d3d10

@softhack007
Copy link
Collaborator

softhack007 commented Jan 25, 2026

@copilot will the script work correctly in the below cases?

  • package.json version "14.7.2"
  • package.json version "14.7.2-beta"
  • package.json version "14.7.8-mdev"

Copy link
Author

Copilot AI commented Jan 25, 2026

@copilot will the script work correctly in the below cases?

  • package.json version "14.7.2"
  • package.json version "14.7.2-beta"
    ...

Yes, the script works correctly for all three cases:

  1. "14.7.2" (no tag)

    • Regular build: 14.7.2 (unchanged)
    • Nightly build: 14.7.2-nightly (appends -nightly)
  2. "14.7.2-beta" (with tag)

    • Regular build: 14.7.2-beta (unchanged)
    • Nightly build: 14.7.2-nightly (replaces -beta with -nightly)
  3. "14.7.8-mdev" (with -mdev tag)

    • Regular build: 14.7.8-mdev (unchanged)
    • Nightly build: 14.7.8-nightly (replaces -mdev with -nightly)

The script logic handles all scenarios:

  • Line 19-20: If version contains -mdev, replace it with -nightly
  • Line 21-23: If version has any other tag (contains -), replace last tag with -nightly using rsplit("-", 1)
  • Line 24-26: If no tag present, append -nightly

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
@softhack007 softhack007 marked this pull request as ready for review January 25, 2026 18:26
@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

The nightly build version-setting functionality has been consolidated from a standalone script into the main version-setting script. The separate set_nightly_version.py script has been deleted, its logic integrated into set_version.py, and the reference removed from platformio.ini's pre-build script chain.

Changes

Cohort / File(s) Summary
Script consolidation
pio-scripts/set_nightly_version.py
Entire script deleted; functionality moved to set_version.py. Previously handled WLED_NIGHTLY_BUILD environment variable check, nightly version_code computation (yymmdd0 format), and BUILD_FLAGS injection.
Script enhancement
pio-scripts/set_version.py
Integrated nightly build logic: added PlatformIO Import comment, new stdlib imports (os, datetime, timezone), conditional nightly version handling with -nightly tag appending, version_code computation, and WLED_BUILD_VERSION flag setting.
Configuration update
platformio.ini
Removed reference to pio-scripts/set_nightly_version.py from pre-build script list.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A script once stood alone so proud,

But now it joins the versioning crowd,

In set_version they're unified,

One mission, one purpose, unified! 📦✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: merging version scripts and changing the nightly tag format from -mdev to -nightly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@softhack007
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@softhack007 softhack007 requested a review from netmindz January 25, 2026 19:02
@softhack007
Copy link
Collaborator

@coderabbitai please verify that the new script works as expected for nightly builds, while preserving the previous behaviour for other CI builds and local development builds.

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read the merged script to analyze the logic
echo "=== Contents of pio-scripts/set_version.py ==="
cat pio-scripts/set_version.py

echo -e "\n=== Contents of package.json (version field) ==="
cat package.json | grep -A2 '"version"'

echo -e "\n=== Check if set_nightly_version.py still exists ==="
if [ -f pio-scripts/set_nightly_version.py ]; then
  echo "File exists"
  cat pio-scripts/set_nightly_version.py
else
  echo "File does not exist (was deleted)"
fi

echo -e "\n=== Check platformio.ini for script references ==="
grep -n "set_version\|set_nightly" platformio.ini

Length of output: 1411


@softhack007: I've verified the merged script behavior. The implementation is correct for all scenarios:

✅ Verification Results

Script Logic Analysis

The merged pio-scripts/set_version.py:

  1. Always reads version from package.json (never modifies the file)
  2. Checks WLED_NIGHTLY_BUILD environment variable
  3. Applies transformations only when WLED_NIGHTLY_BUILD='true'

Nightly CI Builds (WLED_NIGHTLY_BUILD='true')

  • Sets WLED_BUILD_VERSION to date-based code (yymmdd0)
  • Transforms version string to use -nightly suffix:
    • "14.7.2""14.7.2-nightly" (appends)
    • "14.7.2-beta""14.7.2-nightly" (replaces)
    • "14.7.8-mdev""14.7.8-nightly" (replaces)

Other CI Builds & Local Development

  • Uses package.json version unchanged:
    • "14.7.2""14.7.2"
    • "14.7.2-beta""14.7.2-beta"
    • "14.7.8-mdev""14.7.8-mdev"
  • No WLED_BUILD_VERSION set

Key Confirmations

package.json remains at "14.7.2-mdev" (only read, never written)
✅ Old set_nightly_version.py properly removed
platformio.ini references only the merged script
✅ Multi-hyphen versions handled correctly via rsplit("-", 1)

The script correctly preserves previous behavior for non-nightly builds while implementing the new -nightly tagging for nightly CI builds only.



Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Copy link
Collaborator

@softhack007 softhack007 left a comment

Choose a reason for hiding this comment

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

tested locally, looks good to me.

@softhack007 softhack007 added this to the 14.7.3 milestone Jan 25, 2026
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