Skip to content

Commit 5d1af8a

Browse files
8Keepfacebook-github-bot
authored andcommitted
Pull out function to filter for ci workflow targets
Summary: Refactor out shared code from these ci target functions, is_ci_target() Differential Revision: D74018380 fbshipit-source-id: 8a4cab4a2678b25ef821ccddf4867dc182226571
1 parent a48d60d commit 5d1af8a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

btd/src/diff.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,21 @@ pub fn immediate_target_changes<'a>(
338338
res
339339
}
340340

341-
pub fn is_target_with_changed_ci_srcs(buck_target: &BuckTarget, changes: &Changes) -> bool {
341+
pub fn is_ci_target(buck_target: &BuckTarget) -> bool {
342342
let ci_srcs_rule_types = ["ci_skycastle", "ci_sandcastle", "ci_translator_workflow"];
343343

344-
if ci_srcs_rule_types.contains(&buck_target.rule_type.short()) {
344+
ci_srcs_rule_types.contains(&buck_target.rule_type.short())
345+
}
346+
347+
pub fn is_target_with_changed_ci_srcs(buck_target: &BuckTarget, changes: &Changes) -> bool {
348+
if is_ci_target(buck_target) {
345349
return is_changed_ci_srcs(&buck_target.ci_srcs, changes);
346350
}
347351
true
348352
}
349353

350354
pub fn is_target_with_buck_dependencies(buck_target: &BuckTarget) -> bool {
351-
let dependency_checked_rule_types = ["ci_translator_workflow", "ci_skycastle", "ci_sandcastle"];
352-
353-
if dependency_checked_rule_types.contains(&buck_target.rule_type.short()) {
355+
if is_ci_target(buck_target) {
354356
!buck_target.ci_deps.is_empty()
355357
} else {
356358
true

0 commit comments

Comments
 (0)