diff --git a/docs/api/cautious-journey.githubremote.labelname.md b/docs/api/cautious-journey.githubremote.labelname.md new file mode 100644 index 0000000..ab7b344 --- /dev/null +++ b/docs/api/cautious-journey.githubremote.labelname.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [GithubRemote](./cautious-journey.githubremote.md) > [labelName](./cautious-journey.githubremote.labelname.md) + +## GithubRemote.labelName() method + +Signature: + +```typescript +labelName(label: string | { + name?: string; + }): string; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| label | string \| { name?: string; } | | + +Returns: + +string + diff --git a/docs/api/cautious-journey.githubremote.md b/docs/api/cautious-journey.githubremote.md index d6fb3b8..50a891b 100644 --- a/docs/api/cautious-journey.githubremote.md +++ b/docs/api/cautious-journey.githubremote.md @@ -29,6 +29,7 @@ export declare class GithubRemote extends BaseRemote 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) | | | diff --git a/src/remote/github.ts b/src/remote/github.ts index d74a549..52e53e5 100644 --- a/src/remote/github.ts +++ b/src/remote/github.ts @@ -110,6 +110,14 @@ export class GithubRemote extends BaseRemote 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> { const path = await this.resolvePath(options.project); @@ -119,7 +127,7 @@ export class GithubRemote extends BaseRemote 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, });