1
0
Fork 0
mirror of https://gitlab.wikimedia.org/ladsgroup/Phabricator-maintenance-bot synced 2024-11-22 03:52:37 +01:00
This commit is contained in:
Amir Sarabadani 2019-11-26 12:36:02 +01:00
parent 6d0afe93e6
commit 5b02c25f73
3 changed files with 6 additions and 5 deletions

View file

@ -1,5 +1,5 @@
# Phabricator-maintenance-bot # Phabricator-maintenance-bot
Source for https://phabricator.wikimedia.org/p/Maintenance_bot/ Source for https://phabricator.wikimedia.org/p/Maintenance_bot/
* `column_mover.py` is a script that can perform additional actions when someone drags/changes a task in a workboard to a different column. E.g. Moving a task in workborad #user-ladsgroup from column "incoming" to column "done" will automatically change the task's status to "done" * `column_mover.py` is a script that can move columns of a task when some actions happens on it. E.g. Moving a task in workborad #user-ladsgroup from column "incoming" to column "done" when someone changes the task's status to "done"
* `patchforreview_remover.py` is an automatic script that removes the "patch_for_review" tag when all patches have been merged or abandoned * `patchforreview_remover.py` is an automatic script that removes the "patch_for_review" tag when all patches have been merged or abandoned

4
cron
View file

@ -1,3 +1,3 @@
15 * * * * jsub -once -N column_mover python3 /data/project/phabbot/phabbot/column_mover.py >/dev/null 2>&1 15 * * * * jsub -once -N column_mover python3 /data/project/phabbot/phabbot/column_mover.py /data/project/phabbot/phabbot/creds.json 3600 >/dev/null 2>&1
10 * * * * jsub -once -N patch_for_review python3 /data/project/phabbot/phabbot/patchforreview_remover.py >/dev/null 2>&1 10 * * * * jsub -once -N patch_for_review python3 /data/project/phabbot/phabbot/patchforreview_remover.py /data/project/phabbot/phabbot/creds.json 3600 >/dev/null 2>&1
5 * * * * jsub -once -N updater bash /data/project/phabbot/phabbot/updater.sh >/dev/null 2>&1 5 * * * * jsub -once -N updater bash /data/project/phabbot/phabbot/updater.sh >/dev/null 2>&1

5
lib.py
View file

@ -1,5 +1,6 @@
import json import json
import time import time
import sys
import requests import requests
@ -18,7 +19,7 @@ class Client(object):
@classmethod @classmethod
def newFromCreds(cls): def newFromCreds(cls):
with open('creds.json', 'r') as f: with open(sys.argv[1], 'r') as f:
creds = json.loads(f.read()) creds = json.loads(f.read())
return cls(*creds) return cls(*creds)
@ -103,7 +104,7 @@ class Client(object):
'limit': 100, 'limit': 100,
'constraints': { 'constraints': {
'projects': [project_phid], 'projects': [project_phid],
"modifiedStart": int(time.time() - 3600) "modifiedStart": int(time.time() - int(sys.argv[2]))
} }
} }
if continue_: if continue_: