From 5b02c25f7382816244a7b8948fcfc2e532536ae4 Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Tue, 26 Nov 2019 12:36:02 +0100 Subject: [PATCH] Fixes --- README.md | 2 +- cron | 4 ++-- lib.py | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f250665..f0f2c2f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Phabricator-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 diff --git a/cron b/cron index c58358c..ed464a2 100644 --- a/cron +++ b/cron @@ -1,3 +1,3 @@ -15 * * * * jsub -once -N column_mover python3 /data/project/phabbot/phabbot/column_mover.py >/dev/null 2>&1 -10 * * * * jsub -once -N patch_for_review python3 /data/project/phabbot/phabbot/patchforreview_remover.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 /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 diff --git a/lib.py b/lib.py index 985dee5..8b83cb5 100644 --- a/lib.py +++ b/lib.py @@ -1,5 +1,6 @@ import json import time +import sys import requests @@ -18,7 +19,7 @@ class Client(object): @classmethod def newFromCreds(cls): - with open('creds.json', 'r') as f: + with open(sys.argv[1], 'r') as f: creds = json.loads(f.read()) return cls(*creds) @@ -103,7 +104,7 @@ class Client(object): 'limit': 100, 'constraints': { 'projects': [project_phid], - "modifiedStart": int(time.time() - 3600) + "modifiedStart": int(time.time() - int(sys.argv[2])) } } if continue_: