diff --git a/.github/workflows/license_compliance.yml b/.github/workflows/license_compliance.yml index 1c6246b47..e8dbc6cb5 100644 --- a/.github/workflows/license_compliance.yml +++ b/.github/workflows/license_compliance.yml @@ -58,7 +58,7 @@ jobs: - name: Calculate alert data id: calculator shell: bash - if: (success() || failure()) && github.ref_name == 'main' + if: (success() || failure()) run: | if [ "${{ job.status }}" = "success" ]; then echo "alert_type=success" >> "$GITHUB_OUTPUT"; @@ -67,13 +67,13 @@ jobs: fi - name: Send event to Datadog - if: (success() || failure()) && github.ref_name == 'main' + if: (success() || failure()) uses: masci/datadog@v1 with: api-key: ${{ secrets.CORE_DATADOG_API_KEY }} api-url: https://api.datadoghq.eu events: | - - title: "${{ github.workflow }} workflow" + - title: "${{ github.job }} in ${{ github.workflow }} workflow" text: "License compliance check failed:\n ${{ steps.license_check_report.outputs.report }}" alert_type: "${{ steps.calculator.outputs.alert_type }}" source_type_name: "Github" @@ -125,59 +125,36 @@ jobs: if: ${{ always() }} run: echo "${{ steps.license_check_report.outputs.report }}" - - uses: slackapi/slack-github-action@v1.23.0 - if: failure() && github.ref == 'refs/heads/main' - with: - payload: | - { - "blocks": [ - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4", - "alt_text": "Actor" - }, - { - "type": "mrkdwn", - "text": "**" - } - ] - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Job ${{ github.job }} in workflow " - } - }, - { - "type": "context", - "elements": [ - { - "type": "mrkdwn", - "text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`" - } - ] - }, - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://github.githubassets.com/favicons/favicon.png", - "alt_text": "Github logo" - }, - { - "type": "mrkdwn", - "text": " Run " - } - ] - } - ] - } + - name: Calculate alert data + id: calculator + shell: bash + if: (success() || failure()) + run: | + if [ "${{ job.status }}" = "success" ]; then + echo "alert_type=success" >> "$GITHUB_OUTPUT"; + else + echo "alert_type=error" >> "$GITHUB_OUTPUT"; + fi + - name: Send event to Datadog + if: (success() || failure()) + uses: masci/datadog@v1 + with: + api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-url: https://api.datadoghq.eu + events: | + - title: "${{ github.job }} in ${{ github.workflow }} workflow" + text: "License compliance check failed:\n ${{ steps.license_check_report.outputs.report }}" + alert_type: "${{ steps.calculator.outputs.alert_type }}" + 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 }}" license_check_all: name: All extras @@ -217,59 +194,36 @@ jobs: if: ${{ always() }} run: echo "${{ steps.license_check_report.outputs.report }}" - - uses: slackapi/slack-github-action@v1.23.0 - if: failure() && github.ref == 'refs/heads/main' - with: - payload: | - { - "blocks": [ - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4", - "alt_text": "Actor" - }, - { - "type": "mrkdwn", - "text": "**" - } - ] - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Job ${{ github.job }} in workflow " - } - }, - { - "type": "context", - "elements": [ - { - "type": "mrkdwn", - "text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`" - } - ] - }, - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://github.githubassets.com/favicons/favicon.png", - "alt_text": "Github logo" - }, - { - "type": "mrkdwn", - "text": " Run " - } - ] - } - ] - } + - name: Calculate alert data + id: calculator + shell: bash + if: (success() || failure()) + run: | + if [ "${{ job.status }}" = "success" ]; then + echo "alert_type=success" >> "$GITHUB_OUTPUT"; + else + echo "alert_type=error" >> "$GITHUB_OUTPUT"; + fi + - name: Send event to Datadog + if: (success() || failure()) + uses: masci/datadog@v1 + with: + api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-url: https://api.datadoghq.eu + events: | + - title: "${{ github.job }} in ${{ github.workflow }} workflow" + text: "License compliance check failed:\n ${{ steps.license_check_report.outputs.report }}" + alert_type: "${{ steps.calculator.outputs.alert_type }}" + 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 }}" license_check_all_GPU: name: All extras, GPU version @@ -309,55 +263,33 @@ jobs: if: ${{ always() }} run: echo "${{ steps.license_check_report.outputs.report }}" - - uses: slackapi/slack-github-action@v1.23.0 - if: failure() && github.ref == 'refs/heads/main' + - name: Calculate alert data + id: calculator + shell: bash + if: (success() || failure()) + run: | + if [ "${{ job.status }}" = "success" ]; then + echo "alert_type=success" >> "$GITHUB_OUTPUT"; + else + echo "alert_type=error" >> "$GITHUB_OUTPUT"; + fi + + - name: Send event to Datadog + if: (success() || failure()) + uses: masci/datadog@v1 with: - payload: | - { - "blocks": [ - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4", - "alt_text": "Actor" - }, - { - "type": "mrkdwn", - "text": "**" - } - ] - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Job ${{ github.job }} in workflow " - } - }, - { - "type": "context", - "elements": [ - { - "type": "mrkdwn", - "text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`" - } - ] - }, - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://github.githubassets.com/favicons/favicon.png", - "alt_text": "Github logo" - }, - { - "type": "mrkdwn", - "text": " Run " - } - ] - } - ] - } + api-key: ${{ secrets.CORE_DATADOG_API_KEY }} + api-url: https://api.datadoghq.eu + events: | + - title: "${{ github.job }} in ${{ github.workflow }} workflow" + text: "License compliance check failed:\n ${{ steps.license_check_report.outputs.report }}" + alert_type: "${{ steps.calculator.outputs.alert_type }}" + 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 }}"