Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
feat: filter out archived repositories (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbhaxor authored Jan 11, 2023
1 parent 4288ad7 commit e03eaed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export declare type Repository = {
name: string;
url: string;
owner: Owner;
isArchived: boolean;
primaryLanguage: PrimaryLanguage;
codeOfConduct: CodeOfConduct;
licenseInfo: LicenseInfo;
Expand Down
7 changes: 6 additions & 1 deletion src/routes/api/get-issues/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const POST: RequestHandler = async ({ request }) => {
const body = (await request.json()) as { query: string; after?: string };

const octokit = new Octokit({ auth: token });
const { search }: Response = await octokit.graphql(
let { search }: Response = await octokit.graphql(
`query EddieHubIssues($queryString: String!, $skip: Int!, $after: String) {
search(first: $skip, query: $queryString, type: ISSUE, after: $after) {
issueCount
Expand All @@ -43,6 +43,7 @@ export const POST: RequestHandler = async ({ request }) => {
repository {
name
url
isArchived
primaryLanguage {
color
name
Expand Down Expand Up @@ -73,6 +74,10 @@ export const POST: RequestHandler = async ({ request }) => {
after: body.after,
},
);

// filter out archived (read-only) repositories
search = { ...search, edges: search.edges.filter((edge) => !edge.node.repository.isArchived) };

const labels = search.edges.map((el) => el.node.labels.edges.map((label) => label.node.name));
const merged = labels.reduce((acc, val) => {
return acc.concat(val);
Expand Down
1 change: 1 addition & 0 deletions src/stories/issue-card.story.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
repository: {
name: 'LinkFree',
url: 'https://github.com/EddieHubCommunity/LinkFree',
isArchived: false,
primaryLanguage: {
color: '#f1e05a',
name: 'JavaScript',
Expand Down

0 comments on commit e03eaed

Please sign in to comment.