Skip to content

Commit

Permalink
chore: if and throw for null types
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Aug 24, 2024
1 parent d908e06 commit 0dcc361
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/handlers/watch-user-activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ export async function watchUserActivity(context: Context) {

async function updateReminders(context: Context, repo: ListForOrg["data"][0]) {
const { logger, octokit, payload } = context;
const owner = payload.repository.owner?.login;
if (!owner) {
throw new Error("No owner found in the payload");
}
const issues = (await octokit.paginate(octokit.rest.issues.listForRepo, {
owner: payload.repository.owner.login,
owner,
repo: repo.name,
per_page: 100,
state: "open",
Expand Down
6 changes: 5 additions & 1 deletion src/helpers/get-watched-repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export async function getWatchedRepos(context: Context) {
},
} = context;
const repoNames = new Set<string>();
const orgRepos = await getReposForOrg(context, context.payload.repository.owner.login);
const owner = context.payload.repository.owner?.login;
if (!owner) {
throw new Error("No owner found in the payload");
}
const orgRepos = await getReposForOrg(context, owner);
orgRepos.forEach((repo) => repoNames.add(repo.name.toLowerCase()));

for (const repo of optOut) {
Expand Down

0 comments on commit 0dcc361

Please sign in to comment.