Skip to content

Commit 525929b

Browse files
Copilotbenhillis
andcommitted
Add path filters to docs pipeline so it only runs when Guide/ changes
Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
1 parent 57c96b8 commit 525929b

6 files changed

Lines changed: 35 additions & 1 deletion

File tree

.github/workflows/openvmm-docs-ci.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/openvmm-docs-pr.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flowey/flowey_cli/src/pipeline_resolver/github_yaml/github_yaml_defs.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ pub struct PrTrigger {
6969
pub branches_ignore: Vec<String>,
7070
#[serde(skip_serializing_if = "Vec::is_empty")]
7171
pub types: Vec<String>,
72+
#[serde(skip_serializing_if = "Vec::is_empty")]
73+
pub paths: Vec<String>,
74+
#[serde(skip_serializing_if = "Vec::is_empty")]
75+
pub paths_ignore: Vec<String>,
7276
}
7377

7478
#[derive(Debug, Serialize, Deserialize)]
@@ -82,6 +86,10 @@ pub struct CiTrigger {
8286
pub tags: Vec<String>,
8387
#[serde(skip_serializing_if = "Vec::is_empty")]
8488
pub tags_ignore: Vec<String>,
89+
#[serde(skip_serializing_if = "Vec::is_empty")]
90+
pub paths: Vec<String>,
91+
#[serde(skip_serializing_if = "Vec::is_empty")]
92+
pub paths_ignore: Vec<String>,
8593
}
8694

8795
#[derive(Debug, Serialize, Deserialize)]

flowey/flowey_cli/src/pipeline_resolver/github_yaml/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,8 @@ EOF
664664
branches: gh_pr_triggers.branches.clone(),
665665
branches_ignore: gh_pr_triggers.exclude_branches.clone(),
666666
types: gh_pr_triggers.types.clone(),
667+
paths: gh_pr_triggers.paths.clone(),
668+
paths_ignore: gh_pr_triggers.paths_ignore.clone(),
667669
})
668670
}
669671
None => None,
@@ -674,6 +676,8 @@ EOF
674676
branches_ignore: gh_ci_triggers.exclude_branches,
675677
tags: gh_ci_triggers.tags,
676678
tags_ignore: gh_ci_triggers.exclude_tags,
679+
paths: gh_ci_triggers.paths,
680+
paths_ignore: gh_ci_triggers.paths_ignore,
677681
}),
678682
None => None,
679683
},

flowey/flowey_core/src/pipeline.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ pub struct GhPrTriggers {
254254
pub auto_cancel: bool,
255255
/// Run the pipeline whenever the PR trigger matches the specified types
256256
pub types: Vec<String>,
257+
/// Only run the pipeline when files matching these paths are changed
258+
/// (supports glob syntax)
259+
pub paths: Vec<String>,
260+
/// Specify any paths which should be filtered out from the list of
261+
/// `paths` (supports glob syntax)
262+
pub paths_ignore: Vec<String>,
257263
}
258264

259265
/// Trigger Github Actions pipelines per PR
@@ -271,6 +277,12 @@ pub struct GhCiTriggers {
271277
/// Specify any tags which should be filtered out from the list of `tags`
272278
/// (supports glob syntax)
273279
pub exclude_tags: Vec<String>,
280+
/// Only run the pipeline when files matching these paths are changed
281+
/// (supports glob syntax)
282+
pub paths: Vec<String>,
283+
/// Specify any paths which should be filtered out from the list of
284+
/// `paths` (supports glob syntax)
285+
pub paths_ignore: Vec<String>,
274286
}
275287

276288
impl GhPrTriggers {
@@ -286,6 +298,8 @@ impl GhPrTriggers {
286298
"ready_for_review".into(),
287299
],
288300
auto_cancel: true,
301+
paths: Vec::new(),
302+
paths_ignore: Vec::new(),
289303
}
290304
}
291305
}

flowey/flowey_hvlite/src/pipelines/build_docs.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,17 @@ impl IntoPipeline for BuildDocsCli {
4040

4141
let mut pipeline = Pipeline::new();
4242

43-
// The docs pipeline should only run on the main branch.
43+
// The docs pipeline should only run on the main branch, and only when
44+
// the Guide directory is modified.
4445
{
4546
let branches = vec!["main".into()];
47+
let paths = vec!["Guide/**".into()];
4648
match config {
4749
PipelineConfig::Ci => {
4850
pipeline
4951
.gh_set_ci_triggers(GhCiTriggers {
5052
branches,
53+
paths,
5154
..Default::default()
5255
})
5356
.gh_set_name("OpenVMM Docs CI");
@@ -56,6 +59,7 @@ impl IntoPipeline for BuildDocsCli {
5659
pipeline
5760
.gh_set_pr_triggers(GhPrTriggers {
5861
branches,
62+
paths,
5963
..GhPrTriggers::new_draftable()
6064
})
6165
.gh_set_name("OpenVMM Docs PR");

0 commit comments

Comments
 (0)