async function createTeam()

in scripts/create.js [122:148]


async function createTeam() {
  // Find the parent team id
  // TODO this may fail once we have more than *100* teams in the main org
  const {data: allTeams} = await octokit.teams.list({
    org: owner,
    per_page: 100,
  });
  const parent_team_id = allTeams.find(team => team.slug === teamSlug).id;

  // Make the team...
  const {
    data: {id: team_id},
  } = await octokit.teams.create({
    org: owner,
    name: `${repository} ${langName} translation`,
    description: `Discuss the translation of ${repository} into ${langName}.`,
    privacy: 'closed',
    parent_team_id,
  });

  await Promise.all([
    giveTeamRepoAccess(team_id),
    addTeamMembers(team_id, maintainers, 'maintainer'),
  ]);

  logger.info('Set up a new team and invited maintainers!');
}