mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
ci: Use GITHUB_BASE_REF as backup if branch isn't set for DataDog (#321)
The change in #313 caused PRs to report "<id>/merge" as the name.
This commit is contained in:
@ -59,6 +59,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
commitParts := strings.Split(string(commitData), ",")
|
commitParts := strings.Split(string(commitData), ",")
|
||||||
|
|
||||||
|
branch := os.Getenv("GITHUB_HEAD_REF")
|
||||||
|
if branch == "" {
|
||||||
|
branch = os.Getenv("GITHUB_BASE_REF")
|
||||||
|
}
|
||||||
|
|
||||||
tags := map[string]string{
|
tags := map[string]string{
|
||||||
"service": "coder",
|
"service": "coder",
|
||||||
"_dd.cireport_version": "2",
|
"_dd.cireport_version": "2",
|
||||||
@ -78,7 +83,7 @@ func main() {
|
|||||||
"ci.provider.name": "github",
|
"ci.provider.name": "github",
|
||||||
"ci.workspace_path": os.Getenv("GITHUB_WORKSPACE"),
|
"ci.workspace_path": os.Getenv("GITHUB_WORKSPACE"),
|
||||||
|
|
||||||
"git.branch": os.Getenv("GITHUB_REF_NAME"),
|
"git.branch": branch,
|
||||||
"git.commit.sha": githubSHA,
|
"git.commit.sha": githubSHA,
|
||||||
"git.repository_url": fmt.Sprintf("%s/%s.git", githubServerURL, githubRepository),
|
"git.repository_url": fmt.Sprintf("%s/%s.git", githubServerURL, githubRepository),
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user