[libc++] Create issues in batch in libcxx/utils/conformance (#204428)
Also improve the output as a drive-by. Creating issues in batch makes it easier to automate the creation of these issues. Assisted by Claude, tweaked and reviewed by hand
This commit is contained in:
1 parent
6bf6e39d3b
commit
81072db8dd
2 files changed
+28
-25
No files matched your search
@@ -75,10 +75,10 @@ Create the Github tracking issues
|
||||
==================================
|
||||
|
||||
Once the CSV files are committed and any stray issues have been linked, the remaining missing
|
||||
Github issues can be created using ``libcxx/utils/conformance``. For each CSV row, it will
|
||||
create a Github issue (and ask for confirmation) if an issue does not already exist. The issue
|
||||
title, body and labels are all populated automatically, and they are appropriately linked to
|
||||
the libc++ conformance project. Run it once per CSV::
|
||||
Github issues can be created using ``libcxx/utils/conformance``. The script lists every issue
|
||||
it would create from the CSV (skipping rows that are already tracked) and asks for a confirmation
|
||||
before creating them. The issue title, body and labels are all populated automatically, and they
|
||||
are appropriately linked to the libc++ conformance project. Run it once per CSV::
|
||||
|
||||
libcxx/utils/conformance github create libcxx/docs/Status/Cxx<NN>Papers.csv \
|
||||
--labels=wg21-paper --labels=c++<NN>
|
||||
|
||||
+24
-21
@@ -353,7 +353,7 @@ def link_github_issue(issue: str, meeting_voted: Optional[str], status: Optional
|
||||
cli = ['gh', 'project', 'item-edit', '--id', id,
|
||||
'--project-id', LIBCXX_CONFORMANCE_PROJECT_ID,
|
||||
'--field-id', LIBCXX_CONFORMANCE_MEETING_VOTED_ID, '--text', meeting_voted]
|
||||
subprocess.check_call(cli)
|
||||
subprocess.check_call(cli, stdout=subprocess.DEVNULL)
|
||||
|
||||
# Adjust the 'Status' field of the item
|
||||
if status is not None:
|
||||
@@ -362,7 +362,7 @@ def link_github_issue(issue: str, meeting_voted: Optional[str], status: Optional
|
||||
'--project-id', LIBCXX_CONFORMANCE_PROJECT_ID,
|
||||
'--field-id', LIBCXX_CONFORMANCE_STATUS_ID,
|
||||
'--single-select-option-id', option_id]
|
||||
subprocess.check_call(cli)
|
||||
subprocess.check_call(cli, stdout=subprocess.DEVNULL)
|
||||
|
||||
def sync_csv(rows: List[Tuple], from_github: List[PaperInfo]) -> List[Tuple]:
|
||||
"""
|
||||
@@ -524,6 +524,8 @@ def github_create(csvfiles, load_github_from, labels):
|
||||
continue
|
||||
yield row
|
||||
|
||||
all_labels = ('libc++', *labels)
|
||||
to_create = []
|
||||
for row in all_csv_rows():
|
||||
paper = PaperInfo.from_csv_row(row)
|
||||
|
||||
@@ -536,35 +538,36 @@ def github_create(csvfiles, load_github_from, labels):
|
||||
logging.warning(f"Found row claiming to have a tracking issue, but failed to find a tracking issue on Github: {row}")
|
||||
continue
|
||||
|
||||
# Create the actual Github issue
|
||||
title = rst_to_markdown(paper.paper_name)
|
||||
body = f'**Link:** https://wg21.link/{paper.paper_number}'
|
||||
if paper.notes:
|
||||
body += f'\n\n```\nBEGIN-RST-NOTES\n{paper.notes}\nEND-RST-NOTES\n```'
|
||||
|
||||
cli = ['gh', 'issue', 'create', '--repo', 'llvm/llvm-project',
|
||||
'--title', f'{paper.paper_number}: {rst_to_markdown(paper.paper_name)}',
|
||||
'--title', f'{paper.paper_number}: {title}',
|
||||
'--body', body,
|
||||
'--project', 'libc++ Standards Conformance',
|
||||
'--label', 'libc++']
|
||||
|
||||
for label in labels:
|
||||
'--project', 'libc++ Standards Conformance']
|
||||
for label in all_labels:
|
||||
cli += ['--label', label]
|
||||
|
||||
print("Do you want to create the following issue?")
|
||||
print(cli)
|
||||
answer = input("y/n: ")
|
||||
if answer == 'n':
|
||||
print("Not creating issue")
|
||||
continue
|
||||
elif answer != 'y':
|
||||
print(f"Invalid answer {answer}, skipping")
|
||||
continue
|
||||
to_create.append((paper, title, cli))
|
||||
|
||||
logging.info("Creating issue")
|
||||
if not to_create:
|
||||
print("No new issues to create.")
|
||||
return
|
||||
|
||||
print(f"Will create {len(to_create)} issue(s) with labels: {', '.join(all_labels)}")
|
||||
for paper, title, _ in to_create:
|
||||
print(f" {paper.paper_number}: {title}")
|
||||
answer = input(f"\nCreate all {len(to_create)} issue(s)? [y/N]: ")
|
||||
if answer.strip().lower() != 'y':
|
||||
print("Aborted, no issues created.")
|
||||
return
|
||||
|
||||
for i, (paper, _, cli) in enumerate(to_create, 1):
|
||||
print(f"[{i}/{len(to_create)}] Creating {paper.paper_number}... ", end='', flush=True)
|
||||
issue_link = subprocess.check_output(cli).decode().strip()
|
||||
logging.info(f"Created tracking issue for {paper.paper_number}: {issue_link}")
|
||||
|
||||
logging.info(f"Linking {issue_link} to the libc++ Standards Conformance project")
|
||||
print(issue_link)
|
||||
link_github_issue(issue_link, paper.meeting, paper.status)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user