RFC: Add GitHub autolinks to Phab reviews, PRs, etc.?

GitHub allows to turn certain text snippets in commit messages into links, see Configuring autolinks to reference external resources - GitHub Docs. This could be useful for two purposes:

  • Sometimes Phabricator reviews are only mentioned by number and not a full link. We could turn D[0-9]+ into a corresponding Phabricator link. This is also what Phabricator does.
  • Especially in older commits it’s not unusual to have references to bug reports via PR[0-9]+, we could turn those into https://llvm.org/PR<n>.

@tstellar mentioned that there might be a minimum length for what can be turned into a link, so perhaps these aren’t possible.

The good news is that the minimum length requirement is now gone, so adding a ‘D’ auto-link prefix is possible. I set this up in a test repo if people want to experiment and see what it looks like.

1 Like

Based on the “incorrect” Phab links for the very short cases in your code example, I think we might want to have a minimum length anyway. Probably DNNNNN[N*] would be good enough, since that covers all but the first 9999 patches, which are unlikely to ever be linked to these days, I suspect, whilst also minimising the risk of false matches. I don’t think the risk of false matches is as likely for PR links, so I’m happy with those being as short as possible.

It’s great that the minimum length has gone. At the time of bugzilla migration it was minimum 3 characters, we even complained about this to GitHub :slight_smile:

The minimum length was for the string prefix at the beginning. There is no way to limit how many digits are matched after the string. Our only option is matching D[0-9]+.