Update bors e-mail lookup
This commit is contained in:
parent
fc546b94ad
commit
138cc27f49
3 changed files with 24 additions and 4 deletions
2
.github/workflows/post-merge.yml
vendored
2
.github/workflows/post-merge.yml
vendored
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
sleep 60
|
||||
|
||||
# Get closest bors merge commit
|
||||
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
|
||||
PARENT_COMMIT=`git rev-list --author='122020455+rust-bors\[bot\]@users.noreply.github.com' -n1 --first-parent HEAD^1`
|
||||
echo "Parent: ${PARENT_COMMIT}"
|
||||
|
||||
# Find PR for the current commit
|
||||
|
|
|
|||
|
|
@ -152,6 +152,14 @@ pub fn has_changed_since(git_dir: &Path, base: &str, paths: &[&str]) -> bool {
|
|||
})
|
||||
}
|
||||
|
||||
const LEGACY_BORS_EMAIL: &str = "bors@rust-lang.org";
|
||||
|
||||
/// Escape characters from the git user e-mail, so that git commands do not interpret it as regex
|
||||
/// special characters.
|
||||
fn escape_email_git_regex(text: &str) -> String {
|
||||
text.replace("[", "\\[").replace("]", "\\]").replace(".", "\\.")
|
||||
}
|
||||
|
||||
/// Returns the latest upstream commit that modified `target_paths`, or `None` if no such commit
|
||||
/// was found.
|
||||
fn get_latest_upstream_commit_that_modified_files(
|
||||
|
|
@ -182,9 +190,15 @@ fn get_latest_upstream_commit_that_modified_files(
|
|||
"-n1",
|
||||
&upstream,
|
||||
"--author",
|
||||
git_config.git_merge_commit_email,
|
||||
&escape_email_git_regex(git_config.git_merge_commit_email),
|
||||
]);
|
||||
|
||||
// Also search for legacy bors account, before we accrue enough commits to
|
||||
// have changes to all relevant file paths done by new bors.
|
||||
if git_config.git_merge_commit_email != LEGACY_BORS_EMAIL {
|
||||
git.args(["--author", LEGACY_BORS_EMAIL]);
|
||||
}
|
||||
|
||||
if !target_paths.is_empty() {
|
||||
git.arg("--").args(target_paths);
|
||||
}
|
||||
|
|
@ -229,11 +243,17 @@ pub fn get_closest_upstream_commit(
|
|||
git.args([
|
||||
"rev-list",
|
||||
"--author-date-order",
|
||||
&format!("--author={}", config.git_merge_commit_email),
|
||||
&format!("--author={}", &escape_email_git_regex(config.git_merge_commit_email),),
|
||||
"-n1",
|
||||
base,
|
||||
]);
|
||||
|
||||
// Also search for legacy bors account, before we accrue enough commits to
|
||||
// have changes to all relevant file paths done by new bors.
|
||||
if config.git_merge_commit_email != LEGACY_BORS_EMAIL {
|
||||
git.args(["--author", LEGACY_BORS_EMAIL]);
|
||||
}
|
||||
|
||||
let output = output_result(&mut git)?.trim().to_owned();
|
||||
if output.is_empty() { Ok(None) } else { Ok(Some(output)) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
dist_server=https://static.rust-lang.org
|
||||
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
|
||||
artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
|
||||
git_merge_commit_email=bors@rust-lang.org
|
||||
git_merge_commit_email=122020455+rust-bors[bot]@users.noreply.github.com
|
||||
nightly_branch=main
|
||||
|
||||
# The configuration above this comment is editable, and can be changed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue