mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
ci: Update DataDog GitHub branch to fallback to GITHUB_REF (#356)
This was detecting branches, but not our "main" branch before. Hopefully this fixes it!
This commit is contained in:
@ -59,9 +59,16 @@ func main() {
|
||||
}
|
||||
commitParts := strings.Split(string(commitData), ",")
|
||||
|
||||
// On pull requests, this will be set!
|
||||
branch := os.Getenv("GITHUB_HEAD_REF")
|
||||
if branch == "" {
|
||||
branch = os.Getenv("GITHUB_BASE_REF")
|
||||
githubRef := os.Getenv("GITHUB_REF")
|
||||
for _, prefix := range []string{"refs/heads/", "refs/tags/"} {
|
||||
if !strings.HasPrefix(githubRef, prefix) {
|
||||
continue
|
||||
}
|
||||
branch = strings.TrimPrefix(githubRef, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
tags := map[string]string{
|
||||
|
Reference in New Issue
Block a user