fix(remote/github): extract label name when listing issues
This commit is contained in:
parent
0aac555388
commit
d7771474a3
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [GithubRemote](./cautious-journey.githubremote.md) > [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
|
||||
|
|
@ -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) | | |
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue