1
0
Fork 0

fix(remote/github): extract label name when listing issues

This commit is contained in:
Sean Sube 2022-01-30 10:48:16 -06:00
parent 0aac555388
commit d7771474a3
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [labelName](./cautious-journey.githubremote.labelname.md)
## GithubRemote.labelName() method
<b>Signature:</b>
```typescript
labelName(label: string | {
name?: string;
}): string;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| label | string \| { name?: string; } | |
<b>Returns:</b>
string

View File

@ -29,6 +29,7 @@ export declare class GithubRemote extends BaseRemote<Octokit, RemoteOptions> imp
| [createComment(options)](./cautious-journey.githubremote.createcomment.md) | | |
| [createLabel(options)](./cautious-journey.githubremote.createlabel.md) | | |
| [deleteLabel(options)](./cautious-journey.githubremote.deletelabel.md) | | |
| [labelName(label)](./cautious-journey.githubremote.labelname.md) | | |
| [listIssues(options)](./cautious-journey.githubremote.listissues.md) | | |
| [listLabels(options)](./cautious-journey.githubremote.listlabels.md) | | |
| [resolvePath(project)](./cautious-journey.githubremote.resolvepath.md) | | |

View File

@ -110,6 +110,14 @@ export class GithubRemote extends BaseRemote<Octokit, RemoteOptions> implements
return options;
}
public labelName(label: string | { name?: string }): string {
if (typeof label === 'string') {
return label;
} else {
return mustExist(label.name);
}
}
public async listIssues(options: ProjectQuery): Promise<Array<IssueUpdate>> {
const path = await this.resolvePath(options.project);
@ -119,7 +127,7 @@ export class GithubRemote extends BaseRemote<Octokit, RemoteOptions> implements
for (const issue of repo.data) {
issues.push({
issue: issue.number.toString(),
labels: issue.labels.map((l) => l.name).filter(doesExist),
labels: issue.labels.map((l) => this.labelName(l)).filter(doesExist),
name: issue.title,
project: options.project,
});