From 98eb51ae14eeb281648fef6f02f98a333cef382b Mon Sep 17 00:00:00 2001 From: Gaƫtan Gilbert Date: Thu, 28 Dec 2017 21:39:36 +0100 Subject: Python script checking missing/unnecessary [needs: rebase] label --- dev/tools/github-check-prs.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 dev/tools/github-check-prs.py (limited to 'dev/tools/github-check-prs.py') diff --git a/dev/tools/github-check-prs.py b/dev/tools/github-check-prs.py new file mode 100755 index 0000000000..2ba751d07d --- /dev/null +++ b/dev/tools/github-check-prs.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +# Requires PyGithub https://pypi.python.org/pypi/PyGithub +from github import Github + +REPO = "coq/coq" +REBASE_LABEL="needs: rebase" + +token = input("Github access token: ") + +g = Github(token) + +repo = g.get_repo(REPO) + +for pull in repo.get_pulls(): + # if conflicts then dirty + # otherwise blocked (because I have no rights) + dirty = pull.mergeable_state == "dirty" + labelled = False + for label in repo.get_issue(pull.number).get_labels(): + if label.name == REBASE_LABEL: + labelled = True + if labelled and not dirty: + print ("PR #" + str(pull.number) + " is not dirty but is labelled") + elif dirty and not labelled: + print ("PR #" + str(pull.number) + " is dirty and not labelled") + else: + # give some feedback so the user can see we didn't crash + print ("PR #" + str(pull.number) + " OK") -- cgit v1.2.3