Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ GITHUB_API_VERSION=2022-11-28
# valid values are day, week, month, quarter, or year
TIME_PERIOD=month

# any teams to exclude from the results (comma separated list)
EXCLUDE_TEAMS=team1,team2

# pretty, json, hidden
LOG_TYPE=pretty

Expand Down
5 changes: 5 additions & 0 deletions src/data/copilot-associations-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { listCopilotSeats } from "../restapi/copilot";
import { getAuditLogForActor } from "../restapi/organizations";
import { listRepoContributors } from "../restapi/repositories";
import { listTeamMembers, listTeams } from "../restapi/teams";
import { AppConfig } from "../shared/app-config";
import logger from "../shared/app-logger";
import { CopilotSeatAssignee, Repository, TeamInfo, TimePeriodType } from "../shared/shared-types";
import { timestampToDate } from "../shared/time-util";
Expand Down Expand Up @@ -123,6 +124,10 @@ async function processRepositories(repository_owner_name: string, seat_assignee:
async function fetchOrgTeamsMembers(org: string, per_page: number, teams: { [team: string]: TeamInfo }, org_copilot_seats: CopilotSeatAssignee[]) {
let team_count: number = 0;
for await (const team of listTeams({ org, per_page })) {
if (AppConfig.EXCLUDE_TEAMS.includes(team.slug.toLowerCase())) {
continue;
}

processTeams(org, team.slug, per_page, teams, org_copilot_seats);
team_count++;
}
Expand Down
4 changes: 4 additions & 0 deletions src/report/copilot-associations-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function getTeamAssociations(data: CopilotAssociationsData): { member: string, t
const member_teams: { [member: string]: Set<string> } = {};

for (const team_name in data.teams) {
if(AppConfig.EXCLUDE_TEAMS.includes(team_name.toLowerCase())) {
continue;
}

const team = data.teams[team_name];
const copilot_users = new Set(team.copilot_users);

Expand Down
4 changes: 4 additions & 0 deletions src/shared/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export class AppConfig {
public static readonly GENERATE_DATA: boolean = AppConfig.getEnvVar("GENERATE_DATA", "true").toLowerCase() === "true";
public static readonly GITHUB_TOKENS_BY_ORG: { [key: string]: string } = AppConfig.getTokensByOrg(AppConfig.getEnvVar("GITHUB_TOKENS_BY_ORG"));
public static readonly PER_PAGE: number = parseInt(AppConfig.getEnvVar("PER_PAGE", "100"));
public static readonly EXCLUDE_TEAMS: string[] = AppConfig.getEnvVar("EXCLUDE_TEAMS", "")
.split(",")
.map((team) => team.trim().toLowerCase())
.filter((team) => team !== "");

// logging settings
public static readonly MIN_LOG_LEVEL: number = parseInt(AppConfig.getEnvVar("MIN_LOG_LEVEL", "3"));
Expand Down
Loading