Skip to content

Commit

Permalink
workflow to send codeql result as slack notification
Browse files Browse the repository at this point in the history
Signed-off-by: Kartikey Mamgain <[email protected]>
  • Loading branch information
Kartikey-star committed Aug 23, 2023
1 parent 8d74681 commit 8091de8
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [ release-3.11 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [ release-3.11 ]
schedule:
- cron: '29 6 * * 6'

Expand All @@ -35,11 +35,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3 # [email protected]

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -50,7 +50,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -64,4 +64,31 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
id: codeql_analysis
uses: github/codeql-action/analyze@v2 # pinv2.21.2

- name: Send message to helm_dev slack channel
id: notify_dev
if: ${{ always() && github.event_name == 'schedule' && steps.codeql_analysis.conclusion != 'success' }}
uses: archive/[email protected]
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: C02979BDUPL
slack-text: Failure! CodeQL analysis for Helm downstream. See '${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}'

- name: Result from "Send Message to helm_dev slack channel"
if: ${{ always() && github.event_name == 'schedule' && steps.codeql_analysis.conclusion != 'success' }}
run: echo "The result was ${{ steps.notify_dev.outputs.slack-result }}"

- name: Send message to helm_notify slack channel
id: notify
if: ${{ always() && github.event_name == 'schedule' && steps.codeql_analysis.conclusion == 'success' }}
uses: archive/[email protected]
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: C04K1ARMH8A
slack-text: Success! CodeQL analysis for Helm downstream. See '${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}'

- name: Result from "Send Message to helm_notify slack channel"
if: ${{ always() && github.event_name == 'schedule' && steps.codeql_analysis.conclusion == 'success' }}
run: echo "The result was ${{ steps.notify.outputs.slack-result }}"

0 comments on commit 8091de8

Please sign in to comment.