Skip to content

Commit f9d62be

Browse files
committed
Ignore archived repositories during update
1 parent 7de3d2f commit f9d62be

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/github.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ pub async fn get_repo_info(
9292
Ok(locale_en_items) if !locale_en_items.is_empty() => {
9393
Ok(GithubRepoInfo::new_single_mod(full_name))
9494
}
95-
_ => {
96-
Err(GetRepoInfoError::LocaleEnDirectoryMissingOrEmpty)
95+
_ => {
96+
Err(GetRepoInfoError::LocaleEnDirectoryMissingOrEmpty)
9797
}
9898
}
9999
}
@@ -213,6 +213,10 @@ fn check_create_pull_request_response(result: octocrab::Result<PullRequest>, ful
213213
// PR exists - no need to reopen, force push is enough
214214
return;
215215
}
216+
if is_error_repository_archived(&err) {
217+
// Ignore archived repositories, can't create PRs for them
218+
return;
219+
}
216220
panic!("[{}] Can't create pull request: {}", full_name, err);
217221
}
218222

@@ -225,6 +229,11 @@ fn is_error_pull_request_already_exists(error: &Error) -> bool {
225229
message.starts_with("A pull request already exists for")
226230
}
227231

232+
fn is_error_repository_archived(error: &Error) -> bool {
233+
let error_str = format!("{}", error);
234+
error_str.contains("Repository was archived so is read-only")
235+
}
236+
228237
pub async fn get_default_branch(installation_api: &Octocrab, full_name: &str) -> String {
229238
#[derive(Deserialize)]
230239
struct Response { default_branch: String }

0 commit comments

Comments
 (0)