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',
|
|
|
|
'vm-requests',
|
|
|
|
'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',
|
2023-09-05 14:05:22 +02:00
|
|
|
'Challenge',
|
2020-12-26 10:34:50 +01:00
|
|
|
'Comments',
|
|
|
|
'FanBoxes',
|
2023-09-05 14:05:22 +02:00
|
|
|
'ImageRating',
|
2020-12-26 10:34:50 +01:00
|
|
|
'LinkFilter',
|
2023-09-05 14:05:22 +02:00
|
|
|
'MiniInvite',
|
|
|
|
'NewSignupPage',
|
|
|
|
# 'NewUsersList', archived project
|
|
|
|
'PictureGame',
|
2020-12-26 10:34:50 +01:00
|
|
|
'PollNY',
|
|
|
|
'QuizGame',
|
|
|
|
# 'RandomFeaturedUser', archived project
|
|
|
|
'RandomGameUnit',
|
2023-09-05 14:05:22 +02:00
|
|
|
# 'RandomUsersWithAvatars', archived project
|
2020-12-26 10:34:50 +01:00
|
|
|
'SocialProfile',
|
|
|
|
'SiteMetrics',
|
2023-09-05 14:05:22 +02:00
|
|
|
'SportsTeams',
|
|
|
|
# 'TopLists', archived project
|
|
|
|
'video_non-wmf',
|
2020-12-26 10:34:50 +01:00
|
|
|
'VoteNY',
|
|
|
|
'WikiForum',
|
|
|
|
'WikiTextLoggedInOut',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
# 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-20 18:14:46 +02:00
|
|
|
{
|
|
|
|
# H30
|
|
|
|
'add': 'wikidata',
|
|
|
|
'in': [
|
|
|
|
'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',
|
2022-07-10 17:12:04 +02:00
|
|
|
'Wikidata data quality and trust',
|
2023-04-12 18:44:04 +02:00
|
|
|
'Wikidata-UX',
|
2023-09-13 14:08:35 +02:00
|
|
|
'Wikidata Integration in Wikimedia projects',
|
2024-03-30 14:56:07 +01:00
|
|
|
'Wikidata Sitelinks',
|
|
|
|
'Wikidata Change Dispatching & Watchlists',
|
2024-07-15 16:23:59 +02:00
|
|
|
'Wikidata Integration in Wikimedia projects (Sprint Board)',
|
2024-09-17 21:07:07 +02:00
|
|
|
'wmde-wikidata-tech',
|
2024-10-04 15:15:15 +02:00
|
|
|
'MediaWiki-extensions-WikimediaBadges',
|
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',
|
2022-11-29 21:00:00 +01:00
|
|
|
'wikifunctions',
|
2021-06-29 16:40:00 +02:00
|
|
|
'wikilambda',
|
2021-06-29 16:37:16 +02:00
|
|
|
'function-evaluator',
|
|
|
|
'function-orchestrator',
|
|
|
|
'function-schemata',
|
2023-03-13 16:38:37 +01:00
|
|
|
'tool-ducttape',
|
2021-06-29 16:37:16 +02:00
|
|
|
],
|
|
|
|
},
|
2021-12-06 16:07:45 +01:00
|
|
|
{
|
|
|
|
# https://phabricator.wikimedia.org/T295397
|
|
|
|
'add': 'Data-Engineering',
|
|
|
|
'in': [
|
|
|
|
'Event-Platform',
|
|
|
|
'Analytics-Wikistats',
|
|
|
|
],
|
|
|
|
'once': True
|
|
|
|
},
|
2022-08-11 13:01:28 +02:00
|
|
|
{
|
|
|
|
'add': 'growthexperiments-mentorship',
|
|
|
|
'in': [
|
2024-07-04 20:04:37 +02:00
|
|
|
'growthexperiments-personalizedpraise',
|
2022-08-11 13:01:28 +02:00
|
|
|
],
|
|
|
|
},
|
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)
|