Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
fix(issue): log proper message when filtering issues by milestone
Browse files Browse the repository at this point in the history
In the case where we can't find the milestone we should log a helpful message
and bail before trying to list the issues.

fix #703
  • Loading branch information
Ryan Garant committed Oct 16, 2019
1 parent 0dd0c2e commit 5cb1231
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 1 addition & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
"type": "node",
"request": "launch",
"runtimeArgs": ["-r", "ts-node/register"],
"args": [
"${workspaceFolder}/src/debug.ts",
"re",
"-c",
"-u",
"Product",
"--repo",
"service-lumin"
],
"args": ["${workspaceFolder}/src/debug.ts", "is", "--milestone", "Milestone 5"],
// "args": ["${workspaceFolder}/src/debug.ts", "ji", "LWM-117", "--status"],
"console": "integratedTerminal"
},
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,10 @@ gh is --list --state closed
gh is --list --date "dddd, MMMM Do YYYY, h:mm:ss a"
```

- List issues filtered by milestone.
- List issues filtered by milestone title.

```
gh is --list --milestone 1
gh is --list --milestone "milestone title"
```

- List issues that contains labels `todo` and `bug`.
Expand Down
7 changes: 7 additions & 0 deletions src/cmds/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ async function list(options, user, repo) {
.filter(milestone => options.milestone === milestone.title)
.map(milestone => milestone.number)[0]

if (!milestoneNumber) {
logger.log(
`No issues found with milestone title: ${logger.colors.red(options.milestone)}`
)
return
}

payload.milestone = `${milestoneNumber}`
}

Expand Down

0 comments on commit 5cb1231

Please sign in to comment.