diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-04-07 20:02:18 -0700 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-04-08 15:29:19 -0700 |
commit | 860b34cf07661f4ed0fe038a3a7d8b83296e2ad2 (patch) | |
tree | 9e544566e0c70a7249f55a128ef3a003a5b18791 /maintainers | |
parent | 5ec256625e767add1d7cc9bc50b205f60ffb70a0 (diff) |
build-release-notes: support multiple PRs/CLs
Change-Id: I923e4af099d02d2324777cc9f7e6d38b130aac10
Diffstat (limited to 'maintainers')
-rw-r--r-- | maintainers/build-release-notes.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/maintainers/build-release-notes.py b/maintainers/build-release-notes.py index 00c91e5da..dd26fd1cb 100644 --- a/maintainers/build-release-notes.py +++ b/maintainers/build-release-notes.py @@ -28,8 +28,7 @@ def format_issue(issue: str) -> str: return format_link(issue, "issues", "issues") def format_pr(pr: str) -> str: return format_link(pr, "pull", "pulls") -def format_cl(cl: str) -> str: - clid = int(cl) +def format_cl(clid: int) -> str: return f"[cl/{clid}]({GERRIT_BASE}/{clid})" paths = pathlib.Path(sys.argv[1]).glob('*.md') @@ -47,13 +46,19 @@ for p in paths: e.add_note(f"in {p}") raise +def listify(l: list | int) -> list: + if not isinstance(l, list): + return [l] + else: + return l + for p, entry in sorted(entries, key=lambda e: (-SIGNIFICANCECES[e[1].metadata.get('significance')], e[0])): try: header = entry.metadata['synopsis'] links = [] - links += map(format_issue, str(entry.metadata.get('issues', "")).split()) - links += map(format_pr, str(entry.metadata.get('prs', "")).split()) - links += map(format_cl, str(entry.metadata.get('cls', "")).split()) + links += [format_issue(str(s)) for s in listify(entry.metadata.get('issues', []))] + links += [format_pr(str(s)) for s in listify(entry.metadata.get('prs', []))] + links += [format_cl(cl) for cl in listify(entry.metadata.get('cls', []))] if links != []: header += " " + " ".join(links) if header: |