INNER CODE UNIT · JavaScript

getPreviousTag

scality/Zenko · .github/scripts/get-previous-tag.js:2

function getPreviousTag(version, allReleases) {
    while (version) {
        // Peel one trailing segment (separator + non-separator chars).
        // Separators are `.` (major.minor.patch) or `-` (hotfix / pre-release
        // modifier).
        const match = version.match(/([-.])[^-.]+$/);
        if (!match) {
            return undefined;
        }
        const separator = match[1];
        const prefix = version.substring(0, match.index);
        version = prefix;

        // Look for a "direct sibling" at this level: a tag shaped exactly
        // `<prefix><separator><segment>` with no further separators. This
        // excludes side-branch tags (hotfix X.Y.Z-N or X.Y.Z.N) from being
        // picked as the predecessor of a main-line release (X.Y.Z).
        const stem = prefix + separator;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…