Skip to content

Commit 68f5002

Browse files
authored
Script for promoting people to Python triage team. (#345)
1 parent 4a151e8 commit 68f5002

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

utils/promote_to_triager.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# One time script for promoting to the triage team.
2+
# The next iteration better be a bot!
3+
# pip install gidgethub aiohttp cachetools
4+
5+
import os
6+
import asyncio
7+
import aiohttp
8+
9+
from gidgethub.aiohttp import GitHubAPI
10+
11+
import cachetools
12+
13+
cache = cachetools.LRUCache(maxsize=500)
14+
15+
async def get_team(gh, team_name):
16+
"""
17+
Get a team by name (slug)
18+
"""
19+
return await gh.getitem(f"/orgs/python/teams/{team_name}")
20+
21+
async def add_to_team(gh, username, team_id):
22+
await gh.put(f"/teams/{team_id}/memberships/{username}")
23+
24+
25+
async def main():
26+
"""
27+
- Get Python triage team
28+
- Add people to Python Triage team
29+
:return:
30+
"""
31+
async with aiohttp.ClientSession() as session:
32+
# must have repo, and admin:org permissions
33+
gh = GitHubAPI(session, "python", oauth_token=os.getenv("GH_AUTH"), cache=cache)
34+
triage_team = await get_team(gh, "python-triage")
35+
response = await add_to_team(gh, "maxking", triage_team["id"])
36+
37+
asyncio.run(main())

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy