[CodeQL] Added notification to slack on job failure (#210962)

## Summary

Added notification to slack on job failure.


__Closes: https://github.com/elastic/kibana/issues/210957__

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Elena Shostak 2025-02-17 19:28:39 +07:00 committed by GitHub
parent 67f6fd3ec8
commit 80ea2be300
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,7 +31,6 @@ jobs:
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
debug: ${{ matrix.branch != '7.17' }}
# TODO: Possibly required to follow all call paths, however, when enabled, the step below runs out of memory.
# Possible workarounds: Apply for access to the GitHub beta where we can use beefier machines, or run it ourselves on Buildkite
@ -65,11 +64,20 @@ jobs:
category: "/language:${{matrix.language}}"
ref: ${{ env.CHECKOUT_REF }}
sha: ${{ env.CHECKOUT_SHA }}
- name: Notify to slack on failure
if: ${{ failure() }}
uses: slackapi/slack-github-action@v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.CODE_SCANNING_SLACK_TOKEN }}
payload: |
channel: ${{ secrets.CODE_SCANNING_SLACK_CHANNEL_ID }}
text: ":broken_heart: CodeQL analysis failed for ${{ github.repository }} on ${{ env.CHECKOUT_SHA }}."
alert:
name: Alert
runs-on: ubuntu-latest
needs: analyze
if: github.repository == 'elastic/kibana' # Hack: Do not run on forks
if: ${{ github.repository == 'elastic/kibana' && success() }} # Hack: Do not run on forks
steps:
- name: Checkout kibana-operations
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2