Skip to content

Commit

Permalink
Check for potential PR channel
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Oct 6, 2024
1 parent 8a0aff1 commit d4e2334
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/command_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ pub fn run_command_list(paths: &GlobalPaths) -> Result<()> {

let non_db_channels: Vec<String> = (get_channel_variations("nightly")?)
.into_iter()
.map(|arch| format!("nightly~{}", arch))
.chain(std::iter::once("pr{number}".to_string()))
.chain(get_channel_variations("pr{number}")?)
.collect();
let non_db_rows: Vec<ChannelRow> = non_db_channels
.into_iter()
Expand Down
5 changes: 5 additions & 0 deletions src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use console::style;
use flate2::read::GzDecoder;
use indicatif::{ProgressBar, ProgressStyle};
use indoc::formatdoc;
use regex::Regex;
use semver::Version;
#[cfg(not(windows))]
use std::os::unix::fs::PermissionsExt;
Expand Down Expand Up @@ -494,6 +495,10 @@ pub fn is_valid_channel(versions_db: &JuliaupVersionDB, channel: &String) -> Res
Ok(regular || nightly)
}

pub fn is_pr_channel(channel: &String) -> bool {
return Regex::new(r"^(pr\d+)(~|$)").unwrap().is_match(channel);
}

// Identify the unversioned name of a nightly (e.g., `latest-macos-x86_64`) for a channel
pub fn channel_to_name(channel: &String) -> Result<String> {
let mut parts = channel.splitn(2, '~');
Expand Down

0 comments on commit d4e2334

Please sign in to comment.