From 7aa71c46409d86136e299481bd701828b4b394cd Mon Sep 17 00:00:00 2001 From: Mariatta Date: Wed, 31 Jul 2019 18:57:35 -0700 Subject: [PATCH 1/2] Script for promoting people to Python triage team. --- utils/promote_to_triager.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 utils/promote_to_triager.py diff --git a/utils/promote_to_triager.py b/utils/promote_to_triager.py new file mode 100644 index 0000000..0eafb42 --- /dev/null +++ b/utils/promote_to_triager.py @@ -0,0 +1,38 @@ +# One time script for promoting to the triage team. +# The next iteration better be a bot! +# pip install gidgethub aiohttp cachetools + +import os +import asyncio +import aiohttp + +from gidgethub.aiohttp import GitHubAPI + +import cachetools + +cache = cachetools.LRUCache(maxsize=500) + +async def get_team(gh, team_name): + """ + Get a team by name (slug) + """ + return await gh.getitem(f"/orgs/python/teams/{team_name}") + +async def add_to_team(gh, username, team_id): + await gh.put(f"/teams/{team_id}/memberships/{username}") + + +async def main(): + """ + - Get Python triage team + - Get Python core's public repos + - Create Python triage team, assign the repos + :return: + """ + async with aiohttp.ClientSession() as session: + # must have repo, and admin:org permissions + gh = GitHubAPI(session, "python", oauth_token=os.getenv("GH_AUTH"), cache=cache) + triage_team = await get_team(gh, "python-triage") + response = await add_to_team(gh, "maxking", triage_team["id"]) + +asyncio.run(main()) From a3a667176803ec1c5f1a74bc741af6ae3fb6e94e Mon Sep 17 00:00:00 2001 From: Mariatta Date: Wed, 31 Jul 2019 19:01:26 -0700 Subject: [PATCH 2/2] fix the docstring --- utils/promote_to_triager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/promote_to_triager.py b/utils/promote_to_triager.py index 0eafb42..51ad434 100644 --- a/utils/promote_to_triager.py +++ b/utils/promote_to_triager.py @@ -25,8 +25,7 @@ async def add_to_team(gh, username, team_id): async def main(): """ - Get Python triage team - - Get Python core's public repos - - Create Python triage team, assign the repos + - Add people to Python Triage team :return: """ async with aiohttp.ClientSession() as session: 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