-
Notifications
You must be signed in to change notification settings - Fork 91
Improve [rendered-link]
guess of the relevant file to point to
#2118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,13 +42,20 @@ async fn add_rendered_link( | |
|
||
let rendered_link = files | ||
.iter() | ||
.find(|f| { | ||
.filter(|f| { | ||
config | ||
.trigger_files | ||
.iter() | ||
.any(|tf| f.filename.starts_with(tf)) | ||
&& !config | ||
.exclude_files | ||
.iter() | ||
.any(|tf| f.filename.starts_with(tf)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work, because the filename contains the whole path from root (try Probably it would be also more accurate to rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it's on purpose. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I know. It's just that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I though the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the intention to put index .md files into maybe put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this handler work when the patchset does not find .md files to render in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there no relevant files, then nothing happens, the (technically it's a bit more complex since there could have been a match from a previous link from a previous push, so we need to remove it, but that's already handled below) |
||
}) | ||
.and_then(|file| { | ||
// Sort the relavant files by the total number of lines changed, as to | ||
// improve our guess for the relevant file to show the link to. | ||
.max_by_key(|f| f.additions + f.deletions + f.changes) | ||
.map(|file| { | ||
let head = e.issue.head.as_ref()?; | ||
let base = e.issue.base.as_ref()?; | ||
|
||
|
@@ -84,7 +91,8 @@ async fn add_rendered_link( | |
}, | ||
file.filename | ||
)) | ||
}); | ||
}) | ||
.flatten(); | ||
|
||
let new_body: Cow<'_, str> = if !e.issue.body.contains("[Rendered]") { | ||
if let Some(rendered_link) = rendered_link { | ||
|
Uh oh!
There was an error while loading. Please reload this page.