@@ -63,7 +63,7 @@ pub(super) async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
6363 e. issue . set_milestone ( & ctx. github , & version) . await ?;
6464
6565 milestone_submodules ( & ctx. github , e, & version) . await ?;
66- milestone_git_subtrees ( & ctx. github , e, & version) . await ?;
66+ milestone_josh_subtrees ( & ctx. github , e, & version) . await ?;
6767
6868 Ok ( ( ) )
6969}
@@ -197,7 +197,7 @@ async fn milestone_submodule(
197197 Ok ( ( ) )
198198}
199199
200- async fn milestone_git_subtrees (
200+ async fn milestone_josh_subtrees (
201201 gh : & GithubClient ,
202202 event : & IssuesEvent ,
203203 milestone_version : & str ,
@@ -221,7 +221,7 @@ async fn milestone_git_subtrees(
221221 let mv = milestone_version. to_owned ( ) ;
222222 let gh = gh. clone ( ) ;
223223 tokio:: task:: spawn ( async move {
224- if let Err ( e) = milestone_git_subtree ( & gh, repo, commits, mv) . await {
224+ if let Err ( e) = milestone_josh_subtree ( & gh, repo, subtree , commits, mv) . await {
225225 log:: error!( "failed to milestone {subtree}: {e:?}" ) ;
226226 }
227227 } ) ;
@@ -231,10 +231,11 @@ async fn milestone_git_subtrees(
231231 Ok ( ( ) )
232232}
233233
234- /// Try to sync milestones from rust-lang/rust to one of it's git subtrees.
235- async fn milestone_git_subtree (
234+ /// Try to sync milestones from rust-lang/rust to one of it's a JOSH subtrees
235+ async fn milestone_josh_subtree (
236236 gh : & GithubClient ,
237237 repo_name : & str ,
238+ subtree_dir : & str ,
238239 commits : Vec < crate :: github:: GithubCommit > ,
239240 milestone_version : String ,
240241) -> anyhow:: Result < ( ) > {
@@ -280,12 +281,13 @@ async fn milestone_git_subtree(
280281
281282 let pr_numbers = merge_commits
282283 . filter_map ( async |( pr_number, merge_commit) | {
283- // Check that the merge commit exists on the git subtree
284- subtree
285- . github_commit ( & gh, & merge_commit. sha )
286- . await
287- . ok ( )
288- . map ( |_| pr_number)
284+ // Check that the commit only modifies files in the subtree directory
285+ let commit = gh. rust_commit ( & merge_commit. sha ) . await ?;
286+ let files = commit. files ?;
287+ files
288+ . iter ( )
289+ . all ( |f| f. filename . starts_with ( subtree_dir) )
290+ . then_some ( pr_number)
289291 } )
290292 . collect :: < Vec < _ > > ( )
291293 . await ;
0 commit comments