Skip to content

Commit

Permalink
chore: enabled observability
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Oct 2, 2024
1 parent c9fc81c commit 0b3a2bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/utils/issue.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types";
import ms from "ms";
import { Context } from "../types/context";
import { GitHubIssueSearch, Review } from "../types/payload";
Expand Down Expand Up @@ -173,16 +174,17 @@ export async function addAssignees(context: Context, issueNo: number, assignees:

export async function getAllPullRequests(context: Context, state: "open" | "closed" | "all" = "open", username: string) {
const { payload } = context;
const query: RestEndpointMethodTypes["search"]["issuesAndPullRequests"]["parameters"] = {
q: `org:${payload.repository.owner.login} author:${username} state:${state}`,
per_page: 100,
order: "desc",
sort: "created",
};

try {
return (await context.octokit.paginate(context.octokit.search.issuesAndPullRequests, {
q: `org:${payload.repository.owner.login} author:${username} state:${state}`,
per_page: 100,
order: "desc",
sort: "created",
})) as GitHubIssueSearch["items"];
return (await context.octokit.paginate(context.octokit.search.issuesAndPullRequests, query)) as GitHubIssueSearch["items"];
} catch (err: unknown) {
throw new Error(context.logger.error("Fetching all pull requests failed!", { error: err as Error }).logMessage.raw);
throw new Error(context.logger.error("Fetching all pull requests failed!", { error: err as Error, query }).logMessage.raw);
}
}

Expand Down
3 changes: 3 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ compatibility_date = "2024-05-23"
node_compat = true
[env.dev]
[env.prod]

[observability]
enabled = true

0 comments on commit 0b3a2bf

Please sign in to comment.