2020-12-25 11:21:08 +01:00
|
|
|
"""
|
|
|
|
Adds tasks in configured projects to other configured projects
|
|
|
|
"""
|
|
|
|
|
|
|
|
from lib import Client
|
|
|
|
|
2021-04-20 18:14:46 +02:00
|
|
|
# To get it on a list run this on herald rule page
|
|
|
|
# const items = document.getElementsByClassName('herald-list-item')[0].getElementsByClassName('phui-handle')
|
|
|
|
# for (i in items) {console.log(items[i].text)};
|
2020-12-25 11:21:08 +01:00
|
|
|
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
|
2021-05-24 20:47:59 +02:00
|
|
|
'add': 'SRE',
|
2020-12-26 10:34:50 +01:00
|
|
|
'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',
|
|
|
|
],
|
2021-05-24 20:47:59 +02:00
|
|
|
'once': True
|
2020-12-26 10:34:50 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
# 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',
|
|
|
|
],
|
2021-04-14 17:29:47 +02:00
|
|
|
},
|
2021-04-14 19:01:41 +02:00
|
|
|
{
|
|
|
|
'add': 'user-urbanecm-wmf-engineering',
|
|
|
|
'in': [
|
|
|
|
'growth-deployments',
|
|
|
|
]
|
2021-04-20 18:14:46 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
# H30
|
|
|
|
'add': 'wikidata',
|
|
|
|
'in': [
|
|
|
|
'Wikidata-Page-Banner',
|
|
|
|
'Wikibase-Quality-Constraints',
|
|
|
|
'DataValues',
|
|
|
|
'DataValues-JavaScript',
|
|
|
|
'MediaWiki-extensions-WikibaseClient',
|
|
|
|
'MediaWiki-extensions-WikibaseView',
|
|
|
|
'Wikibase-DataModel',
|
|
|
|
'Wikibase-DataModel-JavaScript',
|
|
|
|
'Wikibase-DataModel-Serialization',
|
|
|
|
'Wikibase-Internal-Serialization',
|
|
|
|
'Wikibase-JavaScript-Api',
|
|
|
|
'Wikibase-Serialization-JavaScript',
|
|
|
|
'Wikidata-Query-Service',
|
|
|
|
'Tool-Wikidata-Periodic-Table',
|
|
|
|
'Wikidata.org',
|
|
|
|
'DataTypes',
|
|
|
|
'MediaWiki-extensions-WikibaseRepository',
|
|
|
|
'SDC General',
|
|
|
|
'ValueView',
|
|
|
|
'Wikidata-Gadgets',
|
|
|
|
'ArticlePlaceholder',
|
|
|
|
'Wikidata Lexicographical data',
|
|
|
|
'Automated list generation',
|
|
|
|
'Wikidata Query UI',
|
|
|
|
'Wikibase-Containers',
|
|
|
|
'Soweego',
|
|
|
|
'Wikidata Mobile',
|
|
|
|
'Wikidata-Campsite',
|
|
|
|
'Wikibase-registry',
|
|
|
|
'wikiba.se website',
|
|
|
|
'Wikibase-Lua',
|
|
|
|
'MediaWiki-extensions-PropertySuggester',
|
|
|
|
'Wikidata-Campsite (Wikidata-Campsite-Iteration-∞)',
|
|
|
|
'RL Module Terminators Trailblazing',
|
|
|
|
'Wikidata-Bridge',
|
|
|
|
'Shape Expressions',
|
|
|
|
'Wikidata Tainted References',
|
|
|
|
'Wikidata Design System',
|
|
|
|
'Wikidata - Reference Treasure Hunt',
|
|
|
|
'Item Quality Scoring Improvement',
|
|
|
|
'Wikibase - Automated Configuration Detection (WikibaseManifest)',
|
|
|
|
'Wikidata Query Builder',
|
2021-06-02 11:23:36 +02:00
|
|
|
'Wikidata - Visualisation of Reliability Metrics',
|
|
|
|
'Item Quality Evaluator',
|
|
|
|
'wdwb-tech',
|
2021-06-04 13:59:17 +02:00
|
|
|
'Cognate',
|
2021-06-14 17:07:25 +02:00
|
|
|
'Mismatch Finder',
|
2021-06-29 09:55:12 +02:00
|
|
|
'Wikidata analytics',
|
2021-08-28 19:11:20 +02:00
|
|
|
'Wikidata-Termbox',
|
2022-02-08 09:26:36 +01:00
|
|
|
'Special:NewLexeme revival',
|
2022-07-05 16:39:52 +02:00
|
|
|
'Wikidata Dev Team',
|
2021-04-20 18:14:46 +02:00
|
|
|
],
|
|
|
|
'once': True
|
2021-04-21 15:44:36 +02:00
|
|
|
},
|
2021-12-21 22:04:12 +01:00
|
|
|
{
|
|
|
|
'add': 'Wikidata Lexicographical data',
|
|
|
|
'in': [
|
|
|
|
'Special:NewLexeme revival',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
2021-04-21 15:44:36 +02:00
|
|
|
{
|
|
|
|
# H337
|
|
|
|
'add': 'Research',
|
|
|
|
'in': [
|
|
|
|
'address-knowledge-gaps',
|
|
|
|
'Research-foundational',
|
|
|
|
'Knowledge-Integrity',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
|
|
|
{
|
|
|
|
# H314
|
|
|
|
'add': 'Pywikibot',
|
|
|
|
'in': [
|
|
|
|
'Pywikibot-archivebot.py',
|
|
|
|
'Pywikibot-category.py',
|
|
|
|
'Pywikibot-compat',
|
|
|
|
'Pywikibot-copyright.py',
|
|
|
|
'Pywikibot-delinker.py',
|
|
|
|
'Pywikibot-cosmetic-changes.py',
|
|
|
|
'Pywikibot-Documentation',
|
|
|
|
'Pywikibot-General',
|
|
|
|
'Pywikibot-i18n',
|
|
|
|
'Pywikibot-interwiki.py',
|
|
|
|
'Pywikibot-login.py',
|
|
|
|
'Pywikibot-network',
|
|
|
|
'Pywikibot-Scripts',
|
|
|
|
'Pywikibot-pagegenerators.py',
|
|
|
|
'Pywikibot-redirect.py',
|
|
|
|
'Pywikibot-replace.py',
|
|
|
|
'Pywikibot-solve-disambiguation.py',
|
|
|
|
'Pywikibot-tests',
|
|
|
|
'Pywikibot-textlib.py',
|
|
|
|
'Pywikibot-weblinkchecker.py',
|
|
|
|
'Pywikibot-Wikidata',
|
|
|
|
'Pywikibot-xmlreader.py',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
2021-04-21 16:31:00 +02:00
|
|
|
{
|
|
|
|
# H285
|
|
|
|
'add': 'Product-Analytics',
|
|
|
|
'in': [
|
|
|
|
'Discovery-Analysis',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
|
|
|
{
|
|
|
|
# H216
|
|
|
|
'add': 'WMDE-FUN-Team',
|
|
|
|
'in': [
|
|
|
|
'WMDE-Fundraising-Tech',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
|
|
|
{
|
|
|
|
# H131
|
|
|
|
'add': 'Traffic',
|
|
|
|
'in': [
|
|
|
|
'HTTPS',
|
|
|
|
'DNS',
|
|
|
|
'Domains',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
|
|
|
{
|
|
|
|
# H131
|
|
|
|
'add': 'Traffic',
|
|
|
|
'in': [
|
|
|
|
'HTTPS',
|
|
|
|
'DNS',
|
|
|
|
'Domains',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
|
|
|
{
|
|
|
|
# H109
|
|
|
|
'add': 'Commons',
|
|
|
|
'in': [
|
|
|
|
'MediaWiki-File-management',
|
|
|
|
'MediaWiki-extensions-GWToolset',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
2021-06-29 16:37:16 +02:00
|
|
|
{
|
|
|
|
# Keep all Abstract Wikipedia work on the team board
|
|
|
|
'add': 'abstract_wikipedia',
|
|
|
|
'in': [
|
|
|
|
'abstract_wikipedia_ux',
|
2021-06-29 16:40:00 +02:00
|
|
|
'wikilambda',
|
2021-06-29 16:37:16 +02:00
|
|
|
'function-evaluator',
|
|
|
|
'function-orchestrator',
|
|
|
|
'function-schemata',
|
|
|
|
],
|
|
|
|
},
|
2021-12-06 16:07:45 +01:00
|
|
|
{
|
|
|
|
# https://phabricator.wikimedia.org/T295397
|
|
|
|
'add': 'Data-Engineering',
|
|
|
|
'in': [
|
|
|
|
'Event-Platform',
|
|
|
|
'Analytics-Wikistats',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
2020-12-25 11:21:08 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
client = Client.newFromCreds()
|
|
|
|
|
|
|
|
for rule in rules:
|
|
|
|
handled_tasks = []
|
|
|
|
|
2021-06-29 17:25:44 +02:00
|
|
|
wanted_project_phid = client.lookupPhid('#' + rule['add'].replace(' ', '_'))
|
|
|
|
subprojects = set(client.getSubprojects(wanted_project_phid) + [wanted_project_phid])
|
2020-12-25 11:21:08 +01:00
|
|
|
for project_name in rule['in']:
|
2021-04-20 18:14:46 +02:00
|
|
|
project_name = project_name.replace(' ', '_')
|
2021-04-21 15:50:02 +02:00
|
|
|
try:
|
|
|
|
project_phid = client.lookupPhid('#' + project_name)
|
|
|
|
except:
|
|
|
|
continue
|
2020-12-25 11:21:08 +01:00
|
|
|
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
|
|
|
|
task = client.taskDetails(task_phid)
|
2021-06-29 17:25:44 +02:00
|
|
|
if subprojects.intersection(set(task['projectPHIDs'])):
|
2021-04-20 18:14:46 +02:00
|
|
|
continue
|
|
|
|
if rule.get('once') == True:
|
|
|
|
is_already_added = False
|
|
|
|
transactions = client.getTransactions(task_phid)
|
|
|
|
for transaction in transactions:
|
|
|
|
operations = transaction.get(
|
|
|
|
'fields', {}).get('operations', [])
|
|
|
|
for operation in operations:
|
|
|
|
if operation.get('operation') == 'add' and operation.get('phid') == wanted_project_phid:
|
|
|
|
is_already_added = True
|
|
|
|
break
|
|
|
|
if is_already_added == True:
|
|
|
|
continue
|
|
|
|
handled_tasks.append(task_phid)
|
|
|
|
client.addTaskProject(task_phid, wanted_project_phid)
|