Rename master branch references to main

(cherry picked from commit 4eb0beb3d9)
This commit is contained in:
Redddy 2025-11-10 20:29:33 +09:00 committed by Josh Stone
parent a81d13f102
commit fdcfd0559a
3 changed files with 9 additions and 9 deletions

View file

@ -123,7 +123,7 @@ pub fn load_job_db(db: &str) -> anyhow::Result<JobDatabase> {
/// modulo certain carve-outs" in [`validate_job_database`].
///
/// This invariant is important to make sure that it's not easily possible (without modifying
/// `citool`) to have PRs with red PR-only CI jobs merged into `master`, causing all subsequent PR
/// `citool`) to have PRs with red PR-only CI jobs merged into `main`, causing all subsequent PR
/// CI runs to be red until the cause is fixed.
fn register_pr_jobs_as_auto_jobs(db: &mut JobDatabase) -> anyhow::Result<()> {
for pr_job in &db.pr_jobs {
@ -273,7 +273,7 @@ pub enum RunType {
/// Merge attempt workflow
AutoJob,
/// Fake job only used for sharing Github Actions cache.
MasterJob,
MainJob,
}
/// Maximum number of custom try jobs that can be requested in a single
@ -323,7 +323,7 @@ fn calculate_jobs(
(jobs, "try", &db.envs.try_env)
}
RunType::AutoJob => (db.auto_jobs.clone(), "auto", &db.envs.auto_env),
RunType::MasterJob => return Ok(vec![]),
RunType::MainJob => return Ok(vec![]),
};
let jobs = substitute_github_vars(jobs.clone())
.context("Failed to substitute GitHub context variables in jobs")?;
@ -376,7 +376,7 @@ pub fn calculate_job_matrix(
eprintln!("Run type: {run_type:?}");
let jobs = calculate_jobs(&run_type, &db, channel)?;
if jobs.is_empty() && !matches!(run_type, RunType::MasterJob) {
if jobs.is_empty() && !matches!(run_type, RunType::MainJob) {
return Err(anyhow::anyhow!("Computed job list is empty"));
}
@ -384,7 +384,7 @@ pub fn calculate_job_matrix(
RunType::PullRequest => "pr",
RunType::TryJob { .. } => "try",
RunType::AutoJob => "auto",
RunType::MasterJob => "master",
RunType::MainJob => "main",
};
eprintln!("Output");

View file

@ -47,7 +47,7 @@ impl GitHubContext {
Some(RunType::TryJob { job_patterns: patterns })
}
("push", "refs/heads/auto") => Some(RunType::AutoJob),
("push", "refs/heads/master") => Some(RunType::MasterJob),
("push", "refs/heads/main") => Some(RunType::MainJob),
_ => None,
}
}

View file

@ -46,11 +46,11 @@ fn pr_jobs() {
}
#[test]
fn master_jobs() {
let stdout = get_matrix("push", "commit", "refs/heads/master");
fn main_jobs() {
let stdout = get_matrix("push", "commit", "refs/heads/main");
insta::assert_snapshot!(stdout, @r#"
jobs=[]
run_type=master
run_type=main
"#);
}