Skip to content

ci: Use GITHUB_BASE_REF as backup if branch isn't set for DataDog #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 18, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
kylecarbs committed Feb 18, 2022
commit 92c2ccf7c262f02ee208ad74abd256ec2234ebcb
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