Skip to content

Commit

Permalink
chore: try different auth approach
Browse files Browse the repository at this point in the history
  • Loading branch information
devindford committed Aug 7, 2024
1 parent a7bb191 commit 2b1d49a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/codeowner_review_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ jobs:
// Check if a user is a member of a team
async function checkTeamMembership(teamSlug) {
try {
const octokit = github.getOctokit(process.env.CODEOWNER_WORKFLOW_TOKEN);
const { data: teamMembers } = await octokit.rest.teams.listMembersInOrg({
// Create a new Octokit instance with the custom token
const octokit = new (require('@octokit/rest').Octokit)({
auth: process.env.CODEOWNER_WORKFLOW_TOKEN
});
const { data: teamMembers } = await octokit.teams.listMembersInOrg({
org: context.repo.owner,
team_slug: teamSlug,
});
return teamMembers.some(member => member.login === context.payload.pull_request.user.login);
return teamMembers.some(member => member.login === reviewer);
} catch (error) {
console.error(`Error checking membership for team ${teamSlug}: ${error}`);
return false;
Expand Down

0 comments on commit 2b1d49a

Please sign in to comment.