Skip to content

Commit 7fc3009

Browse files
authored
SONARPHP-1703 Fix Slack notifications in CI (#1490)
1 parent bbdacbe commit 7fc3009

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,32 @@ jobs:
311311
with:
312312
promote-pull-request: true
313313

314+
notify:
315+
runs-on: github-ubuntu-latest-s # Public GH runner is required, runners starting with sonar-* do not support this action
316+
if: ${{ failure() }}
317+
needs: [ build, build_test_analyze, qa_os_win, qa_plugin, qa_ruling, qa_pr_analysis, promote ]
318+
permissions:
319+
id-token: write
320+
steps:
321+
- name: Vault Secrets
322+
id: secrets
323+
uses: SonarSource/vault-action-wrapper@v3
324+
with:
325+
secrets: |
326+
development/kv/data/slack token | SLACK_BOT_TOKEN;
327+
328+
- name: Slack Notification rtCamp
329+
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2.3.3
330+
env:
331+
SLACK_TOKEN: >-
332+
${{ fromJSON(steps.secrets.outputs.vault).SLACK_BOT_TOKEN }}
333+
SLACK_CHANNEL: squad-security-cloud-notifs
334+
SLACK_TITLE: Build Failed
335+
SLACK_MESSAGE: |
336+
Workflow failed in ${{ github.repository }} 🚨
337+
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
338+
Branch: ${{ github.head_ref || github.ref_name }}
339+
Author: ${{ github.event.pull_request.user.login }}
340+
341+
SLACK_USERNAME: BuildBot
342+
SLACK_COLOR: danger

0 commit comments

Comments
 (0)