Skip to content

feat: add release_versions and pre_release_versions config options#198

Closed
yaoge123 wants to merge 2 commits into
tuna:masterfrom
yaoge123:feat/separate-release-versions
Closed

feat: add release_versions and pre_release_versions config options#198
yaoge123 wants to merge 2 commits into
tuna:masterfrom
yaoge123:feat/separate-release-versions

Conversation

@yaoge123
Copy link
Copy Markdown
Contributor

Add support for independently controlling the number of stable releases and pre-releases to sync.

New config fields

  • release_versions: number of stable releases to sync
  • pre_release_versions: number of pre-releases to sync

Usage

{
    "repo": "owner/repo",
    "release_versions": 1,
    "pre_release_versions": 1
}

This will sync the latest 1 stable release AND the latest 1 pre-release, with independent counting.

Backward compatibility

  • Original versions field remains unchanged (mixed sorting mode)
  • When either new field is configured, separate limits mode is activated
  • pre_release field is auto-enabled in separate limits mode

Example scenarios

Config Result
{"repo": "x"} Latest 1 stable release (default)
{"repo": "x", "release_versions": 1, "pre_release_versions": 1} 1 stable + 1 pre-release
{"repo": "x", "versions": 3, "pre_release": true} Latest 3 (mixed, backward compatible)

Copilot AI review requested due to automatic review settings May 17, 2026 08:59
Copy link
Copy Markdown

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

Adds configuration support to control how many stable releases vs pre-releases are synced from GitHub Releases, extending the existing versions/pre_release behavior.

Changes:

  • Introduces release_versions and pre_release_versions config fields and a “separate limits” mode when either is present.
  • Refactors the release iteration logic to track stable vs pre-release counts independently and stop when configured limits are reached.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread github-release.py
prerelease = True
else:
max_release = versions
max_prerelease = 0
Comment thread github-release.py
Comment on lines +293 to +331
# Check version limits
if is_prerelease and max_prerelease > 0:
if n_prerelease >= max_prerelease:
continue
total_size += process_release(
release,
(repo_dir if flat else repo_dir / name),
tarball,
exclude_regexes,
)
if n_downloaded == 0 and not flat:
# create a symbolic link to the latest release folder
link_latest(name, repo_dir)
n_downloaded += 1
if versions > 0 and n_downloaded >= versions:
break
elif not is_prerelease and max_release > 0:
if n_release >= max_release:
continue
elif max_release <= 0 and max_prerelease <= 0:
pass # unlimited
else:
# Mixed mode: skip if respective limit reached
if is_prerelease and max_prerelease <= 0:
continue
if not is_prerelease and max_release <= 0:
continue

name = ensure_safe_name(release["name"] or release["tag_name"])
if len(name) == 0:
logger.error("Unnamed release")
continue
total_size += process_release(
release,
(repo_dir if flat else repo_dir / name),
tarball,
exclude_regexes,
)
if n_downloaded == 0 and not flat:
# create a symbolic link to the latest release folder
link_latest(name, repo_dir)
n_downloaded += 1
if is_prerelease:
n_prerelease += 1
else:
n_release += 1

# Check if both limits are reached
release_done = max_release > 0 and n_release >= max_release
prerelease_done = (not prerelease) or max_prerelease <= 0 or n_prerelease >= max_prerelease
if release_done and prerelease_done:
@yaoge123 yaoge123 force-pushed the feat/separate-release-versions branch from aa87f97 to 100630b Compare May 17, 2026 09:03
@yaoge123 yaoge123 closed this May 17, 2026
@yaoge123 yaoge123 deleted the feat/separate-release-versions branch May 17, 2026 09:04
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