From cc10689d09a43420b9b5a7ec507371f07c1da554 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Fri, 8 Sep 2023 09:59:55 -0700 Subject: [PATCH] Skip running DD on non-master branches so that PRs can run successfully --- .github/workflows/go-test.yml | 3 +++ client/client_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index d44caf3..eaa1bd8 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -49,11 +49,14 @@ jobs: colima start sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock - name: Set up Datadog + if: github.ref == 'refs/heads/master' uses: datadog/agent-github-action@v1.3 with: api_key: ${{ secrets.DD_API_KEY }} - name: Go test if: ${{ !startsWith(github.event.head_commit.message, 'Release') }} + env: + DD_API_KEY: ${{ secrets.DD_API_KEY }} run: | make retrying-test # - name: Setup tmate session diff --git a/client/client_test.go b/client/client_test.go index f884485..507ce36 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -55,7 +55,7 @@ func TestMain(m *testing.M) { } // Configure the integration to export test failures to datadog for better monitoring - if testutils.IsGithubAction() { + if _, has_dd_api_key := os.LookupEnv("DD_API_KEY"); testutils.IsGithubAction() && has_dd_api_key { ddStats, err := statsd.New("localhost:8125") if err != nil { panic(fmt.Errorf("Failed to start DataDog statsd: %w\n", err))