Skip to content

Commit 1aa48cd

Browse files
author
Angelo Buono
authored
Unify Slack notifications with GH action (#425)
1 parent f4a129e commit 1aa48cd

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

.github/workflows/dogfood.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
- master
77
- 'dogfood/**'
88

9-
env:
10-
SLACK_USERNAME: Dogfood build action
11-
129
jobs:
1310
dogfood_merge:
1411
runs-on: ubuntu-latest
@@ -21,7 +18,6 @@ jobs:
2118
uses: SonarSource/vault-action-wrapper@dc8fe04652687f7278f3ecd27905967836bab0eb # tag=2.7.4-1
2219
with:
2320
secrets: |
24-
development/kv/data/slack webhook | SLACK_WEBHOOK;
2521
development/github/token/{REPO_OWNER_NAME_DASH}-dogfood-merge token | dogfood_token;
2622
- name: git octopus step
2723
env:
@@ -33,13 +29,12 @@ jobs:
3329
# Use the output from the `dogfood` step
3430
- name: Get the name of the dogfood branch and its HEAD SHA1
3531
run: echo "The dogfood branch was `${{ steps.dogfood.outputs.dogfood-branch }}` and its HEAD SHA1 was `${{ steps.dogfood.outputs.sha1 }}`"
36-
#slack notifications
32+
# Notify on Slack
3733
- name: Notify failures on Slack
3834
if: failure()
39-
uses: 8398a7/action-slack@v3
40-
with:
41-
status: failure
42-
fields: repo,author,eventName
43-
channel: '#squad-jvm-kotlin'
35+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
4436
env:
45-
SLACK_WEBHOOK_URL: ${{ fromJSON(steps.secrets.outputs.vault).SLACK_WEBHOOK }}
37+
SLACK_BOT_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SLACK_BOT_TOKEN }}
38+
with:
39+
channel-id: squad-jvm-notifs
40+
slack-message: "Dogfood build for `${{ steps.dogfood.outputs.sha1 }}`: *failed*, see the logs at https://github.com/SonarSource/sonar-kotlin/actions/workflows/dogfood.yml"

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
with:
1717
publishToBinaries: true
1818
mavenCentralSync: true
19-
slackChannel: squad-jvm-kotlin
19+
slackChannel: squad-jvm-notifs

.github/workflows/slack_notify.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Slack Notifications
3+
on:
4+
check_run:
5+
types: [rerequested, completed]
6+
7+
jobs:
8+
slack-notifications:
9+
permissions:
10+
id-token: write # to authenticate via OIDC
11+
uses: SonarSource/gh-action_build-notify/.github/workflows/main.yaml@v1
12+
with:
13+
slackChannel: squad-jvm-notifs

0 commit comments

Comments
 (0)