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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add addFilesByExtension method & allow leading slash in path #694
Conversation
Codecov Report
@@ Coverage Diff @@
## master #694 +/- ##
==========================================
+ Coverage 85.38% 85.44% +0.06%
==========================================
Files 49 49
Lines 5945 5972 +27
Branches 531 565 +34
==========================================
+ Hits 5076 5103 +27
Misses 868 868
Partials 1 1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only real nit, is that we should be consistent about removing the leading \
.
I'm fine with not abstracting the removing of a leading slash into a helper yet.
Disclaimer I always give folks using the search based API, GitHub sometimes doesn't immediately index all files. The approach works, but I think can have some hiccups when a new file is initially added (they eventually correct themselves.)
src/release-pr.ts
Outdated
@@ -329,7 +329,11 @@ export class ReleasePR { | |||
|
|||
static addPathStatic(file: string, path?: string) { | |||
if (path === undefined) { | |||
return file; | |||
if (file.startsWith('/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to also check for \
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I was originally getting these back from the github API, which always returns /
, but I could see someone trying to do a path normalization on windows.
src/github.ts
Outdated
): Promise<string[]> { | ||
let q = `extension:${extension}+repo:${this.owner}/${this.repo}`; | ||
if (prefix) { | ||
prefix = prefix.replace(/[/\\]$/, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IF we find ourselves doing this too many more times, it might be worth pulling into a helper, removeLeadingSlash
?
Could just be in the github.js
class I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for the contribution 馃帀
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #692 Fixes #693 馃