Skip to content

Commit

Permalink
fix: filter out pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Jan 23, 2024
1 parent cf45cac commit bd4fbfa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"version": "0.2",
"words": ["supabase"]
"words": [
"devpool",
"supabase"
]
}
8 changes: 5 additions & 3 deletions src/home/fetch-github/fetch-issues-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ export async function fetchIssuePreviews(): Promise<GitHubIssueWithNewFlag[]> {
console.error(error);
}
// Fetch fresh issues and mark them as new if they don't exist in local storage
const freshIssues: GitHubIssue[] = await octokit.paginate("GET /repos/ubiquity/devpool-directory/issues", {
state: "open",
});
const freshIssues: GitHubIssue[] = (
await octokit.paginate<GitHubIssue>("GET /repos/ubiquity/devpool-directory/issues", {
state: "open",
})
).filter((issue: GitHubIssue) => !issue.pull_request);

// Retrieve existing issues from local storage
const storedIssuesJSON = localStorage.getItem("gitHubIssuesPreview");
Expand Down
5 changes: 2 additions & 3 deletions src/home/rendering/render-github-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ function everyNewIssue({ issue, container }: { issue: GitHubIssueWithNewFlag; co
}

const urlPattern = /https:\/\/github\.com\/([^/]+)\/([^/]+)\//;
const match = issue.body?.match(urlPattern);
const match = issue.body.match(urlPattern);
const organizationName = match?.[1];
if (!organizationName) {
console.warn("No organization name found for issue", issue.id);
return;
throw new Error(`No organization name found for issue ${issue.id}`);
}
const repositoryName = match?.[2];
if (!repositoryName) {
Expand Down

0 comments on commit bd4fbfa

Please sign in to comment.