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:
Kyle Carberry 2022-02-24 10:47:51 -06:00 committed by GitHub
parent b913ea85e1
commit 41c3ee72e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -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{