You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2022/07/22 00:34:38 UTC
[lucene-jira-archive] branch main updated: Enable hyperlinks to a commit in commitbots' comments (#57)
This is an automated email from the ASF dual-hosted git repository.
mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene-jira-archive.git
The following commit(s) were added to refs/heads/main by this push:
new 75e70ce3 Enable hyperlinks to a commit in commitbots' comments (#57)
75e70ce3 is described below
commit 75e70ce3abad1b070a44a0b75e0df96afd3eae65
Author: Tomoko Uchida <to...@gmail.com>
AuthorDate: Fri Jul 22 09:34:33 2022 +0900
Enable hyperlinks to a commit in commitbots' comments (#57)
* enable hyperlinks to a commit in commitbots' comments
* add ^ and $ to the regex
---
migration/src/jira2github_import.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/migration/src/jira2github_import.py b/migration/src/jira2github_import.py
index 7edd88da..46a3c7e0 100644
--- a/migration/src/jira2github_import.py
+++ b/migration/src/jira2github_import.py
@@ -123,6 +123,17 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
author_gh = account_map.get(author_name)
return f"{author_dispname} (@{author_gh})" if author_gh else author_dispname
+ def enable_hyperlink_to_commit(comment_body: str):
+ lines = []
+ for line in comment_body.split("\n"):
+ # remove '[' and ']' iff it contains a URL (i.e. link to a commit in ASF GitBox repo).
+ m = re.match(r"^\[\s?(https?://\S+)\s?\]$", line.strip())
+ if m:
+ lines.append(m.group(1))
+ else:
+ lines.append(line)
+ return "\n".join(lines)
+
comments = extract_comments(o)
comments_data = []
for (comment_author_name, comment_author_dispname, comment_body, comment_created, comment_updated, comment_id) in comments:
@@ -135,6 +146,10 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
comment_time += f' [updated: {comment_updated_datetime.strftime("%b %d %Y")}]'
try:
comment_body = f'{convert_text(comment_body, att_replace_map, account_map)}\n\n'
+ # apply a special conversion for jira-bot's comments.
+ # see https://github.com/apache/lucene-jira-archive/issues/54
+ if comment_author_name == "jira-bot":
+ comment_body = enable_hyperlink_to_commit(comment_body)
except Exception as e:
logger.error(traceback.format_exc(limit=100))
logger.error(f"Failed to convert comment on {jira_issue_id(num)} due to above exception ({str(e)}); falling back to original Jira comment as code block.")