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

Commit

Permalink
Merge branch 'development' into fix-654-unexpected-unassign
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Aug 23, 2023
2 parents c73cbc9 + f4751d1 commit 1f109d1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/helpers/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ export const removeAssignees = async (issue_number: number, assignees: string[])
export const checkUserPermissionForRepoAndOrg = async (username: string, context: Context): Promise<boolean> => {
const permissionForRepo = await checkUserPermissionForRepo(username, context);
const permissionForOrg = await checkUserPermissionForOrg(username, context);
const userPermission = await getUserPermission(username, context);

return permissionForOrg || permissionForRepo;
return permissionForOrg || permissionForRepo || userPermission === "admin" || userPermission === "billing_manager";
};

export const checkUserPermissionForRepo = async (username: string, context: Context): Promise<boolean> => {
Expand All @@ -361,12 +362,12 @@ export const checkUserPermissionForOrg = async (username: string, context: Conte
if (!payload.organization) return false;

try {
const res = await context.octokit.rest.orgs.checkMembershipForUser({
await context.octokit.rest.orgs.checkMembershipForUser({
org: payload.organization.login,
username,
});
// @ts-expect-error This looks like a bug in octokit. (https://github.com/octokit/rest.js/issues/188)
return res.status === 204;
// skipping status check due to type error of checkMembershipForUser function of octokit
return true;
} catch (e: unknown) {
logger.error(`Checking if user permisson for org failed!, reason: ${e}`);
return false;
Expand Down

0 comments on commit 1f109d1

Please sign in to comment.