From 48ae01e079b41b3d1355b9829b7de72e158e2783 Mon Sep 17 00:00:00 2001 From: Brian Marks Date: Thu, 30 Jul 2026 10:44:54 -0400 Subject: [PATCH] ci: skip Datadog uploads without an API key --- .github/workflows/dev.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 005797be1..16b607a2c 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -55,7 +55,7 @@ jobs: packages: read env: BUILD_DIR: .build - DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY }} + HAS_DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY != '' }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Configure @@ -67,7 +67,9 @@ jobs: env: ASAN_OPTIONS: alloc_dealloc_mismatch=0 - name: Upload test report to Datadog - if: success() || failure() + if: (success() || failure()) && env.HAS_DD_API_KEY == 'true' + env: + DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY }} run: | curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-${{ matrix.arch }}" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci datadog-ci junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp .build/report.xml @@ -137,7 +139,7 @@ jobs: contents: read packages: read env: - DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY }} + HAS_DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY != '' }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Install Dependency Manager (scoop) @@ -157,7 +159,9 @@ jobs: & 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\Tools\\Launch-VsDevShell.ps1' -arch ${{ matrix.arch }} .\build\test\tests.exe -r junit -o report.xml - name: Upload test report to Datadog - if: success() || failure() + if: (success() || failure()) && env.HAS_DD_API_KEY == 'true' + env: + DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY }} run: | Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "datadog-ci.exe" ./datadog-ci.exe junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp report.xml @@ -172,10 +176,13 @@ jobs: permissions: contents: read packages: read + env: + HAS_DD_API_KEY: ${{ secrets.DD_CI_VIS_API_KEY != '' }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - run: bin/test --coverage --verbose - name: Upload code coverage report to Datadog + if: success() && env.HAS_DD_API_KEY == 'true' # See https://github.com/DataDog/coverage-upload-github-action/releases uses: DataDog/coverage-upload-github-action@2ba057033351887422f8eb0203d1990c3acbc8c5 # v1.0.4 with: