From a9431053a676b6549896f6dedf9ebb47055bec67 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Wed, 13 Mar 2024 11:10:51 +0100 Subject: [PATCH] try using composite action --- .github/workflows/CI_send_failure_event.yml | 25 +++++++++++++++++++++ .github/workflows/fastembed.yml | 22 +++++------------- 2 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/CI_send_failure_event.yml diff --git a/.github/workflows/CI_send_failure_event.yml b/.github/workflows/CI_send_failure_event.yml new file mode 100644 index 000000000..ce5232e9c --- /dev/null +++ b/.github/workflows/CI_send_failure_event.yml @@ -0,0 +1,25 @@ +name: "Send failure event to Datadog" +inputs: + api-key: + description: "Datadog API key" + required: true +runs: + using: "composite" + steps: + - uses: masci/datadog@v1 + with: + api-key: ${{ inputs.api-key }} + api-url: https://api.datadoghq.eu + events: | + - title: "core-integrations nightly failure: ${{ github.workflow }}" + text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" + alert_type: "error" + source_type_name: "Github" + host: ${{ github.repository_owner }} + tags: + - "project:${{ github.repository }}" + - "job:${{ github.job }}" + - "run_id:${{ github.run_id }}" + - "workflow:${{ github.workflow }}" + - "branch:${{ github.ref_name }}" + - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ No newline at end of file diff --git a/.github/workflows/fastembed.yml b/.github/workflows/fastembed.yml index 42d66f7f2..db2309ff5 100644 --- a/.github/workflows/fastembed.yml +++ b/.github/workflows/fastembed.yml @@ -45,21 +45,9 @@ jobs: run: hatch run cov - name: Send failure event to Datadog - if: failure() - uses: masci/datadog@v1 + # we want to send a failure event to Datadog and notify the team + # only if the job fails during scheduled nightly runs + if: failure() #github.event_name == 'schedule' && + uses: ./.github/workflows/CI_send_failure_event.yml with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - api-url: https://api.datadoghq.eu - events: | - - title: "core-integrations nightly failure: ${{ github.workflow }}" - text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" - alert_type: "error" - source_type_name: "Github" - host: ${{ github.repository_owner }} - tags: - - "project:${{ github.repository }}" - - "job:${{ github.job }}" - - "run_id:${{ github.run_id }}" - - "workflow:${{ github.workflow }}" - - "branch:${{ github.ref_name }}" - - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + api-key: ${{ secrets.DATADOG_API_KEY }}