feat(andax/bump_extras.rhai): Alma functions (#7858)

* feat(andax/bump_extras.rhai): Alma function

* cleanup: Formatting cursed so remove comment

* cleanup: Another line so formatting is better?

* fix: IDK what happened there but it wasn't happy?

* feat: Forgot Rhai arrays were like this

* fix: A
This commit is contained in:
Gilver
2025-12-07 03:46:04 -06:00
committed by GitHub
parent c2d7e36003
commit b16d5fdabd
+31
View File
@@ -1,3 +1,34 @@
fn alma_vr(pkg, repo, branch) {
if branch.starts_with("el") {
branch.crop(2);
} else if branch.starts_with("f") {
print(`E: alma functions can only be used on el branches`);
terminate();
} else {
print(`E: unsupported branch: ${labels.branch}`);
terminate();
}
let majorminor = [];
for matches in find_all(`(${branch}\.[\d]+)/`, get("https://repo.almalinux.org/almalinux/")) {
majorminor += matches[1].parse_float();
}
majorminor.dedup();
majorminor.sort();
let url = get(`https://repo.almalinux.org/almalinux/${majorminor[majorminor.len()-1]}/${repo}/x86_64/os/Packages/`);
let matches = find_all(`${pkg}-([\d.]+)-([\d.]+)\.el${branch}.*?\.rpm`, url);
// ──────── ───── .el??
// version release
matches.dedup();
if matches.len() != 0 {
return matches[0];
}
}
fn alma(pkg, branch) {
let vr = alma_vr(pkg, repo, branch);
return(vr[1]);
}
fn codeberg_commit(repo) {
return get(`https://codeberg.org/api/v1/repos/${repo}/commits?stat=false&verification=false&files=false&limit=1`).json_arr()[0].sha;
}