]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script/ceph-release-notes: --html flag to output PRs in HTML 38628/head
authorDavid Galloway <dgallowa@redhat.com>
Thu, 17 Dec 2020 01:13:57 +0000 (20:13 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 17 Dec 2020 01:18:21 +0000 (20:18 -0500)
This will probably only be useful until the new website is done but it'll save me hours.

Signed-off-by: David Galloway <dgallowa@redhat.com>
src/script/ceph-release-notes

index 244cb46c7ff1fffd84392cc24a790684e7605818..c0a7b059a3020ee19fc6b2bcdac86bba4c397c09 100755 (executable)
@@ -137,7 +137,7 @@ def _title_message(commit, pr, strict):
     message = "    " + "\n    ".join(lines)
     return (title, message)
 
-def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags):
+def make_release_notes(gh, repo, ref, plaintext, html, verbose, strict, use_tags):
 
     issue2prs = {}
     pr2issues = {}
@@ -227,6 +227,11 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags):
         if pr in pr2issues:
             if plaintext:
                 issues = map(lambda issue: '#' + str(issue), pr2issues[pr])
+            elif html:
+                issues = map(lambda issue: (
+                    '<a href="http://tracker.ceph.com/issues/{issue}">issue#{issue}</a>'
+                    ).format(issue=issue), pr2issues[pr]
+                )
             else:
                 issues = map(lambda issue: (
                     '`issue#{issue} <http://tracker.ceph.com/issues/{issue}>`_'
@@ -242,6 +247,18 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags):
                     author=author.encode("utf-8")
                 )
             )
+        elif html:
+            print (
+                (
+                    "<li><p>{title} ({issues}<a href=\""
+                    "https://github.com/ceph/ceph/pull/{pr}\""
+                    ">pr#{pr}</a>, {author})</p></li>"
+                ).format(
+                    title=title.encode("utf-8"),
+                    issues=issues,
+                    author=author.encode("utf-8"), pr=pr
+                )
+            )
         else:
             print (
                 (
@@ -279,6 +296,9 @@ if __name__ == "__main__":
     parser.add_argument("--text", "-t",
                         action='store_true', default=None,
                         help="output plain text only, no links")
+    parser.add_argument("--html",
+                        action='store_true', default=None,
+                        help="output html format for website blog")
     parser.add_argument("--verbose", "-v",
                         action='store_true', default=None,
                         help="verbose")
@@ -304,6 +324,7 @@ if __name__ == "__main__":
         Repo(args.repo),
         args.rev,
         args.text,
+        args.html,
         args.verbose,
         args.strict,
         args.use_tags