-
-
Couldn't load subscription status.
- Fork 19
Search by title input #41
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 |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ const main = async () => { | |
| const state = core.getInput('state') | ||
| const sort = core.getInput('sort') | ||
| const direction = core.getInput('direction') | ||
| const title = core.getInput('title') | ||
| const repoString = core.getInput('repo') | ||
|
|
||
| let repoObject | ||
|
|
@@ -44,9 +45,13 @@ const main = async () => { | |
| const octokit = github.getOctokit(token) | ||
|
|
||
| const res = await octokit.rest.pulls.list(query) | ||
| const pr = author | ||
| ? res.data.length && res.data.filter(pr => pr.user.login === author)[0] | ||
| : res.data.length && res.data[0] | ||
| const pr = | ||
| res.data.length && | ||
| res.data.filter( | ||
| pr => | ||
| (!author || pr.user.login === author) && | ||
| (!title || pr.title.match(new RegExp(title))) | ||
|
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. do you need this to be a regular expression? could it be a substring? or do you want to match on the exact title? 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. Regex covers more use cases; pattern matching, partial matching or exact matches should be supported (I haven't tried this). Plain strings can still be used, with the cavat that special characters will have to be escaped. (This is how I'm using it). 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. Gotcha, shall we simplify this PR then by only supporting exact matches for now? |
||
| )[0] | ||
|
|
||
| core.debug(`pr: ${JSON.stringify(pr, null, 2)}`) | ||
| core.setOutput('number', pr ? pr.number : '') | ||
|
|
||
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.