From c23cac321510a26f7c614591f8057a7a39a64f41 Mon Sep 17 00:00:00 2001 From: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> Date: Wed, 13 Sep 2023 14:10:30 +0200 Subject: [PATCH] Try to send event to Datadog only if possible (#5795) --- .github/workflows/license_compliance.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/license_compliance.yml b/.github/workflows/license_compliance.yml index 47dfb8177..0c5e50466 100644 --- a/.github/workflows/license_compliance.yml +++ b/.github/workflows/license_compliance.yml @@ -9,6 +9,9 @@ on: schedule: - cron: "0 0 * * *" # every day at midnight +env: + CORE_DATADOG_API_KEY: ${{ secrets.CORE_DATADOG_API_KEY }} + jobs: license_check_direct: name: Direct dependencies only @@ -71,10 +74,10 @@ jobs: # secrets are not accessible. # To prevent showing bogus failures in those PRs we skip the step. # The workflow will fail in any case if the actual check fails in the previous steps. - if: (success() || failure()) && github.repository == 'deepset-ai/haystack' + if: (success() || failure()) && env.CORE_DATADOG_API_KEY != '' uses: masci/datadog@v1 with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-key: ${{ env.CORE_DATADOG_API_KEY }} api-url: https://api.datadoghq.eu events: | - title: "${{ github.job }} in ${{ github.workflow }} workflow" @@ -145,10 +148,10 @@ jobs: # secrets are not accessible. # To prevent showing bogus failures in those PRs we skip the step. # The workflow will fail in any case if the actual check fails in the previous steps. - if: (success() || failure()) && github.repository == 'deepset-ai/haystack' + if: (success() || failure()) && env.CORE_DATADOG_API_KEY != '' uses: masci/datadog@v1 with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-key: ${{ env.CORE_DATADOG_API_KEY }} api-url: https://api.datadoghq.eu events: | - title: "${{ github.job }} in ${{ github.workflow }} workflow" @@ -218,10 +221,10 @@ jobs: # secrets are not accessible. # To prevent showing bogus failures in those PRs we skip the step. # The workflow will fail in any case if the actual check fails in the previous steps. - if: (success() || failure()) && github.repository == 'deepset-ai/haystack' + if: (success() || failure()) && env.CORE_DATADOG_API_KEY != '' uses: masci/datadog@v1 with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-key: ${{ env.CORE_DATADOG_API_KEY }} api-url: https://api.datadoghq.eu events: | - title: "${{ github.job }} in ${{ github.workflow }} workflow" @@ -291,10 +294,10 @@ jobs: # secrets are not accessible. # To prevent showing bogus failures in those PRs we skip the step. # The workflow will fail in any case if the actual check fails in the previous steps. - if: (success() || failure()) && github.repository == 'deepset-ai/haystack' + if: (success() || failure()) && env.CORE_DATADOG_API_KEY != '' uses: masci/datadog@v1 with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-key: ${{ env.CORE_DATADOG_API_KEY }} api-url: https://api.datadoghq.eu events: | - title: "${{ github.job }} in ${{ github.workflow }} workflow"