summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-11-16 07:18:44 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-11-16 07:18:44 +0100
commitb147539a0b245c5ba7d6217487d398f7a401521e (patch)
treea4d27ffb2faa0a9783bb1e3e9d1ce6344326d9e5
parent49100ca0c37364b7cc29e911e72af26917fd8c94 (diff)
downloadpsutil-b147539a0b245c5ba7d6217487d398f7a401521e.tar.gz
look for bug + enhancement labels
-rw-r--r--.github/workflows/issue_labels.yml1
-rwxr-xr-xscripts/internal/github_issue_labeler.py21
2 files changed, 14 insertions, 8 deletions
diff --git a/.github/workflows/issue_labels.yml b/.github/workflows/issue_labels.yml
index 0ee5ef2e..3ff73ea8 100644
--- a/.github/workflows/issue_labels.yml
+++ b/.github/workflows/issue_labels.yml
@@ -27,7 +27,6 @@ jobs:
{"keywords": ["sunos", "solaris"], "labels": ["sunos"], "assignees": ["wiggin15"]},
{"keywords": ["windows", "win32", "WinError", "WindowsError", "win10", "win7", "win", "mingw", "msys", "studio", "microsoft", "MSVC", "TCHAR", "WCHAR", "make.bat", ".bat", "appveyor", "handles", "CloseHandle", "GetLastError", "NtQuery", "OpenProcess", "TerminateProcess", "DLL"], "labels": ["windows"], "assignees": [""]},
{"keywords": ["wsl"], "labels": ["wsl"], "assignees": [""]},
- {"keywords": ["bug", "raise", "exception", "traceback"], "labels": ["bug"], "assignees": [""]},
{"keywords": ["enhancement"], "labels": ["enhancement"], "assignees": [""]},
{"keywords": ["doc ", "document ", "documentation", "readthedocs", "pythonhosted", "HISTORY.txt", "README"], "labels": ["doc"], "assignees": [""]},
{"keywords": ["idea", "proposal", "api", "feature"], "labels": ["api", "enhancement"], "assignees": [""]},
diff --git a/scripts/internal/github_issue_labeler.py b/scripts/internal/github_issue_labeler.py
index d031c124..988b9951 100755
--- a/scripts/internal/github_issue_labeler.py
+++ b/scripts/internal/github_issue_labeler.py
@@ -21,7 +21,7 @@ PROJECT = "psutil"
OS_LABELS = ["linux", "windows", "macos", "freebsd", "openbsd", "netbsd",
"openbsd", "sunos", "unix", "wsl", "aix", "cygwin"]
TOKEN = ""
-DRYRUN = False
+WRITE = False
class Retriever:
@@ -53,7 +53,7 @@ class Retriever:
def add_label(issue, label):
print("adding label %r to '#%r: %s'" % (
label, issue.number, issue.title))
- if not DRYRUN:
+ if WRITE:
issue.add_to_labels(label)
@@ -101,7 +101,7 @@ def guess_labels_from_title(issue):
["psposix", "waitpid", "statvfs", "/dev/tty", "/dev/pts"])
# types
- check_for(issue, "bug", ["bug", "raise", "exception", "traceback"])
+ # check_for(issue, " bug ", ["bug"])
check_for(issue, "enhancement", ["enhancement"])
check_for(
issue, "memleak",
@@ -129,17 +129,23 @@ def guess_labels_from_title(issue):
"segmentation fault", "ZeroDivisionError", "SystemError"])
+def logical_label_adjustment(issue):
+ labels = [x.name for x in issue.labels]
+ if 'bug' in labels and 'enhancement' in labels:
+ print(">>> WARN: can't have 'bug' + 'enhancement' labels: %r" % issue)
+
+
def main():
- global DRYRUN
+ global WRITE
# parser
parser = argparse.ArgumentParser(description='GitHub issue labeler')
parser.add_argument('--tokenfile', required=False,
default='~/.github.token',
help="a path to file contaning the GH token")
- parser.add_argument('-d', '--dryrun', required=False, default=False,
+ parser.add_argument('--write', required=False, default=False,
action='store_true',
- help="don't make actual changes")
+ help="do the actual changes (default: dryrun)")
parser.add_argument('--pulls', required=False, default=False,
action='store_true',
help="only process PRs (not issues)")
@@ -150,7 +156,7 @@ def main():
# set globals
with open(os.path.expanduser(args.tokenfile)) as f:
token = f.read().strip()
- DRYRUN = args.dryrun
+ WRITE = args.write
# run
retr = Retriever(token)
@@ -160,6 +166,7 @@ def main():
issues = retr.get_issues(args.status)
for issue in issues:
guess_labels_from_title(issue)
+ logical_label_adjustment(issue)
if __name__ == '__main__':