From d9e1665d4b9fa4ed33394e625a0509694bb6c900 Mon Sep 17 00:00:00 2001 From: benedikt-voelkel Date: Mon, 22 Apr 2024 14:48:04 +0200 Subject: [PATCH] [AsyncSW] Small fixes, bit of polishing (#1601) Co-authored-by: Benedikt Volkel --- UTILS/o2dpg_make_github_pr_report.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/UTILS/o2dpg_make_github_pr_report.py b/UTILS/o2dpg_make_github_pr_report.py index 587523121..9a3a83b9c 100755 --- a/UTILS/o2dpg_make_github_pr_report.py +++ b/UTILS/o2dpg_make_github_pr_report.py @@ -156,12 +156,14 @@ def make_report(all_prs, repo, labels_request, label_accept_suffix, outfile=None # collect the labels for which table this PR should be taken into account labels_take = [] - for label in pr['labels']: - label_name = label['name'] + pr_labels = [label['name'] for label in pr['labels']] + for label_name in pr_labels: + if label_name not in labels_request: + continue if label_name.lower() in ('mc', 'data'): # get assigned MC or DATA label if this PR has it - mc_data.append(label['name']) - if label_name in labels_request and (not label_accept_suffix or f'{label_name}-{label_accept_suffix}' not in pr['labels']): + mc_data.append(label_name) + if not label_accept_suffix or f'{label_name}-{label_accept_suffix}' not in pr_labels: # check if that label is one that flags a request. If at the same time there is also the corresponding accepted label, don't take this PR into account for the report. labels_take.append(label_name) @@ -199,14 +201,14 @@ def make_report(all_prs, repo, labels_request, label_accept_suffix, outfile=None parser.add_argument('--start-page', dest='start_page', type=int, default=1, help='Start on this page') parser.add_argument('--pages', type=int, default=5, help='Number of pages') parser.add_argument('--label-regex', dest='label_regex', help='Provide a regular expression to decide which labels to fetch.', default='^async-\w+') - parser.add_argument('--label-accepted-suffix', dest='label_accepted_suffix', help='Provide a regular expression to decide which labels to fetch.', default='accept') + parser.add_argument('--label-accepted-suffix', dest='label_accepted_suffix', help='Provide the suffix of labels that indicate acceptance (a dash will be added automatically, so the a corresponding accepted label is expected to have the form -).', default='accepted') parser.add_argument('--include-accepted', action='store_true', help='By default, only PRs are fetched where at least one label has no "