diff --git a/src/handlers/watch-user-activity.ts b/src/handlers/watch-user-activity.ts index 1c781e1..1caae0c 100644 --- a/src/handlers/watch-user-activity.ts +++ b/src/handlers/watch-user-activity.ts @@ -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", diff --git a/src/helpers/get-watched-repos.ts b/src/helpers/get-watched-repos.ts index f0ade6d..a261367 100644 --- a/src/helpers/get-watched-repos.ts +++ b/src/helpers/get-watched-repos.ts @@ -8,7 +8,11 @@ export async function getWatchedRepos(context: Context) { }, } = context; const repoNames = new Set(); - 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) {