Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Issue 51: Adding updatedAt and labels to the output #53

Merged
merged 4 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/gitHubIssueFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export interface GitHubIssue {
createdAt: string;
repository: GitHubRepository;
url: string;
updatedAt: string;
labels: { edges: Array<{ node: { name: string}}> };
kevindigo marked this conversation as resolved.
Show resolved Hide resolved
}

interface GitHubRepository {
Expand Down Expand Up @@ -68,6 +70,14 @@ query findByLabel($queryString:String!, $pageSize:Int, $after:String) {
nameWithOwner
}
url
updatedAt
labels(first: $pageSize) {
kevindigo marked this conversation as resolved.
Show resolved Hide resolved
edges{
node{
name
}
}
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/issueFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export interface Issue {
createdAt: string;
repositoryNameWithOwner: string;
url: string;
updatedAt: string;
labels: string[];
}

export class IssueFinder {
Expand Down Expand Up @@ -56,11 +58,20 @@ export class IssueFinder {
createdAt: node.createdAt,
repositoryNameWithOwner: node.repository.nameWithOwner,
url: node.url,
updatedAt: node.createdAt,
kevindigo marked this conversation as resolved.
Show resolved Hide resolved
labels: this.convertFromGitHubLabels(node.labels.edges)
kevindigo marked this conversation as resolved.
Show resolved Hide resolved
};

return issue;
}

private convertFromGitHubLabels(edges: Array<{ node: { name: string}}>) {
const labels = edges.reduce((labels: string[], edge) => {
kevindigo marked this conversation as resolved.
Show resolved Hide resolved
return[...labels, edge.node.name]
}, [])
return labels;
}

private omitDuplicates(issues: Issue[]): Issue[] {
const map = new Map<string, Issue>();
issues.forEach((issue) => {
Expand Down