dev/internal: create team package
Created by: bobheadxi
Extracts teammate data resolving out of buildchecker
into a separate package, and extends it significantly such that it can also replace the teammate querying in sg teammate
.
❯ go run . teammate handbook jh
Opening handbook link for JH Chabran: https://handbook.sourcegraph.com/team#jh-chabran
❯ go run . teammate time jh
JH Chabran's current time is 13 Jan 22 02:11 CET (1h from your local time)
For https://github.com/sourcegraph/sourcegraph/issues/25454 - this will give us an API we can use for generating direct message notifications in the pipeline.
Package usage:
import "github.com/sourcegraph/sourcegraph/dev/internal/team"
func main() {
// ...
// Neither a GitHub client nor a Slack client is required, but each enables more ways
// to query for users and/or get additional metadata about a user.
teammates := team.NewTeammateResolver(githubClient, slackClient)
tm, _ := teammates.ResolveByName(ctx, "Robert")
println(tm.SlackID)
println(tm.HandbookLink)
println(tm.Role)
// etc.
}