1
0
Fork 0
mirror of https://gitlab.wikimedia.org/ladsgroup/Phabricator-maintenance-bot synced 2024-11-28 15:02:39 +01:00
Phabricator-maintenance-bot/project_grouper.py

128 lines
3.7 KiB
Python
Raw Normal View History

2020-12-25 11:21:08 +01:00
"""
Adds tasks in configured projects to other configured projects
"""
from lib import Client
rules = [
{
2020-12-26 10:34:50 +01:00
# H175 - see T136921
2020-12-25 11:21:08 +01:00
'add': 'Design',
'in': ['WMF-Design', 'WMDE-Design'],
},
2020-12-26 10:34:50 +01:00
{
# H232
'add': 'artificial-intelligence',
'in': ['editquality-modeling', 'draftquality-modeling', 'articlequality-modeling', 'revscoring'],
},
{
# H193 - see T146701
'add': 'accessibility',
'in': ['ios-app-feature-accessibility'],
},
{
# H174
'add': 'upstream',
'in': ['phabricator-upstream'],
},
{
# H24 - see T86536
'add': 'universallanguageselector',
'in': ['uls-compactlinks'],
},
{
# H15 - note that #producrement tasks are private -> rule can't be disabled
'add': 'Operations',
'in': [
'ops-eqiad',
'ops-codfw',
'ops-esams',
'ops-ulsfo',
# 'hardware-requests', archived project
'SRE-Access-Requests',
'netops',
'vm-requests',
'Traffic',
'ops-eqord',
'ops-eqdfw',
# 'procurement', always in S4
'ops-eqsin',
'DNS',
'LDAP-Access-Requests',
'Wikimedia-Mailing-lists',
],
},
{
# H14 - see T85596
'add': 'Social-Tools',
'in': [
'BlogPage',
'Comments',
'FanBoxes',
'LinkFilter',
'PollNY',
'QuizGame',
# 'RandomFeaturedUser', archived project
'RandomGameUnit',
'SocialProfile',
'SiteMetrics',
'VoteNY',
'WikiForum',
'WikiTextLoggedInOut',
'Challenge',
'MiniInvite',
# 'NewUsersList', archived project
'PictureGame',
# 'RandomUsersWithAvatars', archived project
2020-12-26 10:37:34 +01:00
'video_non-wmf',
2020-12-26 10:34:50 +01:00
# 'TopLists', archived project
],
},
{
# H10 - see T76954
'add': 'VisualEditor',
'in': [
'VisualEditor-ContentEditable',
'VisualEditor-ContentLanguage',
'VisualEditor-CopyPaste',
'VisualEditor-DataModel',
'VisualEditor-EditingTools',
'VisualEditor-Initialisation',
'VisualEditor-InterfaceLanguage',
'VisualEditor-MediaWiki',
'VisualEditor-MediaWiki-Links',
'VisualEditor-MediaWiki-Media',
'VisualEditor-MediaWiki-Mobile',
'VisualEditor-MediaWiki-References',
'VisualEditor-MediaWiki-Templates',
'VisualEditor-Performance',
'VisualEditor-Tables',
'TemplateData',
'VisualEditor-MediaWiki-Plugins',
'VisualEditor-LanguageTool',
'VisualEditor-Links',
'VisualEditor-Media',
'VisualEditor-MediaWiki-2017WikitextEditor',
'VisualEditor-VisualDiffs',
],
}
2020-12-25 11:21:08 +01:00
]
client = Client.newFromCreds()
for rule in rules:
handled_tasks = []
wanted_project_phid = client.lookupPhid('#' + rule['add'])
for project_name in rule['in']:
project_phid = client.lookupPhid('#' + project_name)
for task_phid in client.getTasksWithProject(project_phid):
# if a task is in multiple 'in' projects, still only process it once
if task_phid in handled_tasks:
continue
handled_tasks.append(task_phid)
task = client.taskDetails(task_phid)
if wanted_project_phid not in task['projectPHIDs']:
client.addTaskProject(task_phid, wanted_project_phid)