Skip to content

Commit b744193

Browse files
committed
Add exclude list for rendered-link handler
1 parent 51616b1 commit b744193

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/config.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,14 @@ pub(crate) struct BotPullRequests {}
497497
#[serde(deny_unknown_fields)]
498498
pub(crate) struct RenderedLinkConfig {
499499
pub(crate) trigger_files: Vec<String>,
500+
#[serde(default = "RenderedLinkConfig::default_exclude_files")]
501+
pub(crate) exclude_files: Vec<String>,
502+
}
503+
504+
impl RenderedLinkConfig {
505+
fn default_exclude_files() -> Vec<String> {
506+
vec!["SUMMARY.md".to_string()]
507+
}
500508
}
501509

502510
#[derive(PartialEq, Eq, Debug, serde::Deserialize)]
@@ -720,7 +728,8 @@ mod tests {
720728
merge_conflicts: None,
721729
bot_pull_requests: None,
722730
rendered_link: Some(RenderedLinkConfig {
723-
trigger_files: vec!["posts/".to_string()]
731+
trigger_files: vec!["posts/".to_string()],
732+
exclude_files: vec!["SUMMARY.md".to_string()],
724733
}),
725734
issue_links: Some(IssueLinksConfig {
726735
check_commits: true,

src/handlers/rendered_link.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ async fn add_rendered_link(
4747
.trigger_files
4848
.iter()
4949
.any(|tf| f.filename.starts_with(tf))
50+
&& !config
51+
.exclude_files
52+
.iter()
53+
.any(|tf| f.filename.starts_with(tf))
5054
})
5155
.and_then(|file| {
5256
let head = e.issue.head.as_ref()?;

0 commit comments

Comments
 (0)