Auto merge of #150783 - Kobzol:bors-email-update, r=jieyouxu
Update bors e-mail lookup This should hopefully fix the post-merge CI workflow and git change detection in bootstrap.
This commit is contained in:
commit
598c7bde38
4 changed files with 24 additions and 15 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)) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,16 +312,6 @@ else
|
|||
command=(/checkout/src/ci/run.sh)
|
||||
fi
|
||||
|
||||
if isCI; then
|
||||
# Get some needed information for $BASE_COMMIT
|
||||
#
|
||||
# This command gets the last merge commit which we'll use as base to list
|
||||
# deleted files since then.
|
||||
BASE_COMMIT="$(git log --author=bors@rust-lang.org -n 2 --pretty=format:%H | tail -n 1)"
|
||||
else
|
||||
BASE_COMMIT=""
|
||||
fi
|
||||
|
||||
SUMMARY_FILE=github-summary.md
|
||||
touch $objdir/${SUMMARY_FILE}
|
||||
|
||||
|
|
@ -359,7 +349,6 @@ docker \
|
|||
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
|
||||
--env CI_JOB_NAME="${CI_JOB_NAME-$image}" \
|
||||
--env CI_JOB_DOC_URL="${CI_JOB_DOC_URL}" \
|
||||
--env BASE_COMMIT="$BASE_COMMIT" \
|
||||
--env DIST_TRY_BUILD \
|
||||
--env PR_CI_JOB \
|
||||
--env OBJDIR_ON_HOST="$objdir" \
|
||||
|
|
|
|||
|
|
@ -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