在 github 中使 jira 链接可点击

make jira links clickable in github

我是否可以直接将 github link 上的 jira 票证 ID 直接发送到 jira? (与在 bitbucket 上发生的方式大致相同?) 也许有我可以使用的插件或其他东西?

抱歉,如果post这类问题的地方不对,请评论我是否应该post在其他地方。

编辑:
我特别想要从 github 到 link 到 JIRA 的票证 ID,这在以下任何资源中都没有描述:

如果您的意思是提交 e0d9e32 的提交消息显示 TEST-1234 Fixed this really bad bug 并且您希望 TEST-1234 到 link 到 http://www.your-jira.com/browse/TEST-1234 那么不,它看起来不像这样是可以的。

您可以考虑做一个 Chrome/Firefox 浏览器插件来完成您想要的行为。 (扫描网页以查找 JIRA Key 的某些部分,然后将它们更新为 links)

我决定为此做一个 Chrome 扩展!此扩展适用于所有网站,而不仅仅是 Jira! :D

在此处安装:
https://chrome.google.com/webstore/detail/jira-hotlinker/lbifpcpomdegljfpfhgfcjdabbeallhk

源代码:
https://github.com/helmus/Jira-Hot-Linker

我写了一个站点特定的 Safari hack。它需要您自己安装,但这样您就有机会先阅读代码(它很短!)。 https://github.com/unicode-org/icu-jira-safari

  • 它使用 getElementsByClassName()
  • 获取 class commitgh-header-titlejs-issue-row 的元素
  • 然后,对于诸如 ICU-1234(我们的 Jira 项目 ID)之类的任何内容,它会在 Jira 服务器上为适当的 URL 创建一个 link。

我也想包括 Jira 问题状态,但是 Atlassian Cloud CORS 设置 prevent that

这里有一个例子,如果 link化(ICU-10464 在右边变成 link)。

有人用 gitlab 做了我想要的。

https://chrome.google.com/webstore/detail/linkify-jira-issues/ekbbnaokafbanjgmcbllligemhiclbcb

这会更新我的 github PR 中的文本,以将它们转换为可点击的链接。

2022 年更新:

Dusan Plavak mentions in that, as of today (Q1 2022), you can also import / automate creation of autolinks via github api.

你也可以使用gh api:

gh api repos/octocat/hello-world/autolinks \
       -f -q 'key_prefix:key_prefix url_template:url_template'

2019:不需要 Chrome 插件、Safari hack 或脚本。

从 2019 年 10 月开始,GitHub 可以自动将 TICKET 引用转换为 Jira 链接,例如。

参见“Save time linking resources with autolink references" from Lars Schneider

Now you can set up an autolink reference and GitHub will automatically create links (to external systems) for you.

How it works

If you use GitHub with external services (like Jira), you might be familiar with shorthand references (like TICKET-123) to point to resources in those external systems.

Starting today, GitHub can automatically transform shorthand references into clickable links for GitHub Pro, Team, and Enterprise plans.

所以不是常规的 github.com。

To enable this feature, a repository admin needs to register the reference prefix (such as TICKET-) in the settings.
Afterwards, references of that type are detected in issues, pull requests, comments, or commit messages, and turned into links.

This speeds up navigation between GitHub and external systems.

参见documentation

请注意,尽管包含在锚文本中,但票证前缀并未包含在超链接中。设置中的URL预览准确:

上面复制的功能公告中的动画显示了此限制,但不是很清楚。

这意味着您必须在目标 URL 中也包含项目密钥,或者使用另一个密钥作为所有项目密钥的前缀并将其用作自动链接前缀。

您甚至不能使用 Git 的 trailers 来引用票证和使用自动链接,因为预告片是由 : (冒号 space)分隔的键值对以 space 结尾的自动链接前缀无效。

我为此做了一个超级简单的 Chrome 扩展。它只是以一种非侵入性的方式将 link 添加到您的 Github 拉取请求页面上的相关 JIRA 票证(请参见下面的屏幕截图)

在此处安装:https://chrome.google.com/webstore/detail/github-to-jira/dhnagjladcclacjnccpnibdmkljidnhl?hl=en-GB

源代码在这里:https://github.com/mfalade/github-to-jira

虽然 Github Autolink 是一个很棒的解决方案,但由于以下原因,它更易于使用。

  • 您无需提供带有票号的说明即可使用。它会自动从您的分行名称中获取票号。

  • 您无需在 Github 管理页面上进行任何配置。非常适合没有管理员权限的用户

  • 您可以更轻松地处理多个项目或团队。支持多个工单前缀。

  • 此扩展适用于您可能想要 link 到

    的所有项目管理工具