Skip to content

Commit 598c7bd

Browse files
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.
2 parents 548e586 + f2d0d52 commit 598c7bd

4 files changed

Lines changed: 24 additions & 15 deletions

File tree

.github/workflows/post-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
sleep 60
3030
3131
# Get closest bors merge commit
32-
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
32+
PARENT_COMMIT=`git rev-list --author='122020455+rust-bors\[bot\]@users.noreply.github.com' -n1 --first-parent HEAD^1`
3333
echo "Parent: ${PARENT_COMMIT}"
3434
3535
# Find PR for the current commit

src/build_helper/src/git.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ pub fn has_changed_since(git_dir: &Path, base: &str, paths: &[&str]) -> bool {
152152
})
153153
}
154154

155+
const LEGACY_BORS_EMAIL: &str = "bors@rust-lang.org";
156+
157+
/// Escape characters from the git user e-mail, so that git commands do not interpret it as regex
158+
/// special characters.
159+
fn escape_email_git_regex(text: &str) -> String {
160+
text.replace("[", "\\[").replace("]", "\\]").replace(".", "\\.")
161+
}
162+
155163
/// Returns the latest upstream commit that modified `target_paths`, or `None` if no such commit
156164
/// was found.
157165
fn get_latest_upstream_commit_that_modified_files(
@@ -182,9 +190,15 @@ fn get_latest_upstream_commit_that_modified_files(
182190
"-n1",
183191
&upstream,
184192
"--author",
185-
git_config.git_merge_commit_email,
193+
&escape_email_git_regex(git_config.git_merge_commit_email),
186194
]);
187195

196+
// Also search for legacy bors account, before we accrue enough commits to
197+
// have changes to all relevant file paths done by new bors.
198+
if git_config.git_merge_commit_email != LEGACY_BORS_EMAIL {
199+
git.args(["--author", LEGACY_BORS_EMAIL]);
200+
}
201+
188202
if !target_paths.is_empty() {
189203
git.arg("--").args(target_paths);
190204
}
@@ -229,11 +243,17 @@ pub fn get_closest_upstream_commit(
229243
git.args([
230244
"rev-list",
231245
"--author-date-order",
232-
&format!("--author={}", config.git_merge_commit_email),
246+
&format!("--author={}", &escape_email_git_regex(config.git_merge_commit_email),),
233247
"-n1",
234248
base,
235249
]);
236250

251+
// Also search for legacy bors account, before we accrue enough commits to
252+
// have changes to all relevant file paths done by new bors.
253+
if config.git_merge_commit_email != LEGACY_BORS_EMAIL {
254+
git.args(["--author", LEGACY_BORS_EMAIL]);
255+
}
256+
237257
let output = output_result(&mut git)?.trim().to_owned();
238258
if output.is_empty() { Ok(None) } else { Ok(Some(output)) }
239259
}

src/ci/docker/run.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,6 @@ else
312312
command=(/checkout/src/ci/run.sh)
313313
fi
314314

315-
if isCI; then
316-
# Get some needed information for $BASE_COMMIT
317-
#
318-
# This command gets the last merge commit which we'll use as base to list
319-
# deleted files since then.
320-
BASE_COMMIT="$(git log --author=bors@rust-lang.org -n 2 --pretty=format:%H | tail -n 1)"
321-
else
322-
BASE_COMMIT=""
323-
fi
324-
325315
SUMMARY_FILE=github-summary.md
326316
touch $objdir/${SUMMARY_FILE}
327317

@@ -359,7 +349,6 @@ docker \
359349
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
360350
--env CI_JOB_NAME="${CI_JOB_NAME-$image}" \
361351
--env CI_JOB_DOC_URL="${CI_JOB_DOC_URL}" \
362-
--env BASE_COMMIT="$BASE_COMMIT" \
363352
--env DIST_TRY_BUILD \
364353
--env PR_CI_JOB \
365354
--env OBJDIR_ON_HOST="$objdir" \

src/stage0

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dist_server=https://static.rust-lang.org
22
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
33
artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
4-
git_merge_commit_email=bors@rust-lang.org
4+
git_merge_commit_email=122020455+rust-bors[bot]@users.noreply.github.com
55
nightly_branch=main
66

77
# The configuration above this comment is editable, and can be changed

0 commit comments

Comments
 (0)