summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-04-24 16:23:01 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-04-24 16:23:07 -0600
commit71b547e969c1fd96edc0a05a8c185f16c2d3ed0e (patch)
tree4a8f80807e74ea7ba3395b3deb905b7bd5afb42f
parenta8a7dd0d3ebdf819b663296ad5b7492a12d55794 (diff)
imworkingon: automatically include short URLs for golang CLs
-rw-r--r--cmd/generate/src_contribs.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/cmd/generate/src_contribs.go b/cmd/generate/src_contribs.go
index 5d34fef..bbb87a6 100644
--- a/cmd/generate/src_contribs.go
+++ b/cmd/generate/src_contribs.go
@@ -67,6 +67,11 @@ func (c *Contribution) Fill() error {
if err != nil {
return err
}
+ for _, u := range c.URLs {
+ if m := reGoLangGerritCL.FindStringSubmatch(u); m != nil {
+ c.URLs = append(c.URLs, "https://golang.org/cl/"+m[1])
+ }
+ }
return nil
}
@@ -86,10 +91,11 @@ func classifyStatus(status string) (string, error) {
}
var (
- reGitHubPR = regexp.MustCompile(`^https://github.com/([^/?#]+)/([^/?#]+)/pull/([0-9]+)(?:\?[^#]*)?(?:#.*)?$`)
- reGitHubCommit = regexp.MustCompile(`^https://github.com/([^/?#]+)/([^/?#]+)/commit/([0-9a-f]+)(?:\?[^#]*)?(?:#.*)?$`)
- reGitLabMR = regexp.MustCompile(`^https://([^/]+)/([^?#]+)/-/merge_requests/([0-9]+)(?:\?[^#]*)?(?:#.*)?$`)
- rePiperMailDate = regexp.MustCompile(`^\s*<I>([^<]+)</I>\s*$`)
+ reGoLangGerritCL = regexp.MustCompile(`https://go-review\.googlesource\.com/c/[^/?#]+/\+/([0-9]+)(?:\?[^#]*)?(?:#.*)?$`)
+ reGitHubPR = regexp.MustCompile(`^https://github\.com/([^/?#]+)/([^/?#]+)/pull/([0-9]+)(?:\?[^#]*)?(?:#.*)?$`)
+ reGitHubCommit = regexp.MustCompile(`^https://github\.com/([^/?#]+)/([^/?#]+)/commit/([0-9a-f]+)(?:\?[^#]*)?(?:#.*)?$`)
+ reGitLabMR = regexp.MustCompile(`^https://([^/]+)/([^?#]+)/-/merge_requests/([0-9]+)(?:\?[^#]*)?(?:#.*)?$`)
+ rePiperMailDate = regexp.MustCompile(`^\s*<I>([^<]+)</I>\s*$`)
)
const (