Skip to content

Commit

Permalink
Bug 1309112 - Detect and linkify GitHub issue in comment
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastinSanty authored and dylanwh committed Mar 15, 2017
1 parent 4da65f2 commit d7dacb9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions extensions/BMO/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,18 @@ sub bug_format_comment {
}
});

# link github pull requests and issues
push (@$regexes, {
match => qr/(\s)([A-Za-z0-9_\.-]+)\/([A-Za-z0-9_\.-]+)\#([0-9]+)\b/,
replace => sub {
my $args = shift;
my $owner = html_quote($args->{matches}->[1]);
my $repo = html_quote($args->{matches}->[2]);
my $number = html_quote($args->{matches}->[3]);
return qq# <a href="https://github.com/$owner/$repo/issues/$number">$owner/$repo\#$number</a>#;
}
});

# Update certain links to git.mozilla.org to go to github.com instead
# https://git.mozilla.org/?p=webtools/bmo/bugzilla.git;a=blob;f=Bugzilla/WebService/Bug.pm;h=d7a1d8f9bb5fdee524f2bb342a4573a63d890f2e;hb=HEAD#l657
push(@$regexes, {
Expand Down

0 comments on commit d7dacb9

Please sign in to comment.