Skip to content

Commit d9e1665

Browse files
benedikt-voelkelBenedikt Volkel
andauthored
[AsyncSW] Small fixes, bit of polishing (#1601)
Co-authored-by: Benedikt Volkel <benedikt.volkel@cern.ch>
1 parent 51b6c24 commit d9e1665

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

UTILS/o2dpg_make_github_pr_report.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,14 @@ def make_report(all_prs, repo, labels_request, label_accept_suffix, outfile=None
156156
# collect the labels for which table this PR should be taken into account
157157
labels_take = []
158158

159-
for label in pr['labels']:
160-
label_name = label['name']
159+
pr_labels = [label['name'] for label in pr['labels']]
160+
for label_name in pr_labels:
161+
if label_name not in labels_request:
162+
continue
161163
if label_name.lower() in ('mc', 'data'):
162164
# get assigned MC or DATA label if this PR has it
163-
mc_data.append(label['name'])
164-
if label_name in labels_request and (not label_accept_suffix or f'{label_name}-{label_accept_suffix}' not in pr['labels']):
165+
mc_data.append(label_name)
166+
if not label_accept_suffix or f'{label_name}-{label_accept_suffix}' not in pr_labels:
165167
# 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.
166168
labels_take.append(label_name)
167169

@@ -199,14 +201,14 @@ def make_report(all_prs, repo, labels_request, label_accept_suffix, outfile=None
199201
parser.add_argument('--start-page', dest='start_page', type=int, default=1, help='Start on this page')
200202
parser.add_argument('--pages', type=int, default=5, help='Number of pages')
201203
parser.add_argument('--label-regex', dest='label_regex', help='Provide a regular expression to decide which labels to fetch.', default='^async-\w+')
202-
parser.add_argument('--label-accepted-suffix', dest='label_accepted_suffix', help='Provide a regular expression to decide which labels to fetch.', default='accept')
204+
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 <request-label>-<accepted-suffix>).', default='accepted')
203205
parser.add_argument('--include-accepted', action='store_true', help='By default, only PRs are fetched where at least one label has no "<label>-accepted" label')
204206
args = parser.parse_args()
205207

206208
# get all labels of interest
207209
labels = get_labels(args.owner, args.repo, args.label_regex)
208210
# split into request and accept labels, here we currently only need the request labels
209-
labels_request, _ = separate_labels_request_accept(labels, args.label_accepted_suffix)
211+
labels_request, l = separate_labels_request_accept(labels, args.label_accepted_suffix)
210212

211213
# Retrieve closed pull requests with the specified label, split into merged and other (closed) PRs
212214
prs = get_prs(args.owner, args.repo, labels_request, args.pr_state, args.per_page, args.start_page, args.pages)

0 commit comments

Comments
 (0)