Skip to content

Commit

Permalink
ci: Use GITHUB_BASE_REF as backup if branch isn't set for DataDog (#321)
Browse files Browse the repository at this point in the history
The change in #313 caused PRs to report "<id>/merge" as the name.
  • Loading branch information
kylecarbs committed Feb 18, 2022
1 parent 6170421 commit 5bfdb0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/datadog-cireport/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func main() {
}
commitParts := strings.Split(string(commitData), ",")

branch := os.Getenv("GITHUB_HEAD_REF")
if branch == "" {
branch = os.Getenv("GITHUB_BASE_REF")
}

tags := map[string]string{
"service": "coder",
"_dd.cireport_version": "2",
Expand All @@ -78,7 +83,7 @@ func main() {
"ci.provider.name": "github",
"ci.workspace_path": os.Getenv("GITHUB_WORKSPACE"),

"git.branch": os.Getenv("GITHUB_REF_NAME"),
"git.branch": branch,
"git.commit.sha": githubSHA,
"git.repository_url": fmt.Sprintf("%s/%s.git", githubServerURL, githubRepository),

Expand Down

0 comments on commit 5bfdb0c

Please sign in to comment.