Skip to content

Commit 92c2ccf

Browse files
committed
ci: Use GITHUB_BASE_REF as backup if branch isn't set for DataDog
The change in #313 caused PRs to report "<id>/merge" as the name.
1 parent 4c71ff9 commit 92c2ccf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/datadog-cireport/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ func main() {
5959
}
6060
commitParts := strings.Split(string(commitData), ",")
6161

62+
branch := os.Getenv("GITHUB_HEAD_REF")
63+
if branch == "" {
64+
branch = os.Getenv("GITHUB_BASE_REF")
65+
}
66+
6267
tags := map[string]string{
6368
"service": "coder",
6469
"_dd.cireport_version": "2",
@@ -78,7 +83,7 @@ func main() {
7883
"ci.provider.name": "github",
7984
"ci.workspace_path": os.Getenv("GITHUB_WORKSPACE"),
8085

81-
"git.branch": os.Getenv("GITHUB_REF_NAME"),
86+
"git.branch": branch,
8287
"git.commit.sha": githubSHA,
8388
"git.repository_url": fmt.Sprintf("%s/%s.git", githubServerURL, githubRepository),
8489

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy