Skip to content

Commit 044d961

Browse files
committed
emeritus
1 parent 5426daf commit 044d961

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ node --env-file=.env index.js onboard --username <user> --team collaborators --t
2525

2626
### Offboard a user
2727

28-
This command removes a user from the active teams in the GitHub organization and npm maintainers.
28+
This command removes a user from the active teams in the GitHub organization and npm teams
29+
and adds the user to the `emeritus` team if it exists.
2930

3031
```bash
3132
node --env-file=.env index.js offboard --org <org> --username <user> [--dryRun]

commands/offboard.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default async function offboard ({ logger, client }, { org, username, dry
1616
const orgData = await client.getOrgData(org)
1717
logger.info('Organization ID %s', orgData.id)
1818
const orgTeams = await client.getOrgChart(orgData)
19+
const emeritusTeam = orgTeams.find(team => team.slug === 'emeritus')
1920

2021
/** GitHub Cleanup */
2122
const userTeams = orgTeams.filter(t => t.members.find(m => m.login === joiningUser.login))
@@ -29,6 +30,16 @@ export default async function offboard ({ logger, client }, { org, username, dry
2930
await client.removeUserFromTeam(orgData.name, team.slug, joiningUser.login)
3031
logger.info('Removed %s from team %s', joiningUser.login, team.slug)
3132
}
33+
34+
if (emeritusTeam) {
35+
if (dryRun) {
36+
logger.warn('[DRY RUN] This user %s will be added to emeritus team', joiningUser.login)
37+
} else {
38+
await client.addUserToTeam(orgData.name, emeritusTeam.slug, joiningUser.login)
39+
logger.info('Added %s to emeritus team', joiningUser.login)
40+
}
41+
}
42+
3243
logger.info('GitHub offboarding completed for user %s ✅ ', joiningUser.login)
3344

3445
/** NPM Cleanup */

0 commit comments

Comments
 (0)