Skip to content

Commit 41e9330

Browse files
committed
Slack notifications
Add slack notifications to each of the workflows so that when issues are created or when jobs fail we get notified of it.
1 parent 9966821 commit 41e9330

5 files changed

Lines changed: 93 additions & 8 deletions

File tree

.github/workflows/generate.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,15 @@ jobs:
5252
run: gh pr create -f
5353
env:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
- name: Slack notification
56+
uses: ravsamhq/notify-slack-action@v2
57+
if: always()
58+
with:
59+
status: ${{ job.status }}
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
notification_title: "{repo}: {workflow} workflow"
62+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
63+
footer: "<{workflow_url}|View Workflow>"
64+
notify_when: "failure"
65+
env:
66+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/generate_publish_release.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ jobs:
1616
- name: Bump version
1717
id: bump_version
1818
run: echo "::set-output name=version::$(ruby .github/version.rb ${{ github.event.client_payload.version }})"
19-
2019
- name: Clean repo
2120
run: ruby .github/clean.rb
22-
2321
- name: Install openapi-generator-cli
2422
run: |
2523
npm install @openapitools/openapi-generator-cli -g
@@ -30,10 +28,8 @@ jobs:
3028
-g java \
3129
-c ./openapi/config.yml \
3230
-t ./openapi/templates
33-
3431
- name: Checkout master
3532
run: git checkout master
36-
3733
- name: Create commit
3834
run: |
3935
git config user.name "devexperience"
@@ -42,11 +38,22 @@ jobs:
4238
git commit -m "Generated version ${{ steps.bump_version.outputs.version }}
4339
4440
This commit was automatically created by a GitHub Action to generate version ${{ steps.bump_version.outputs.version }} of this library."
45-
4641
- name: Push to master
4742
run: git push origin master
4843
env:
4944
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Slack notification
46+
uses: ravsamhq/notify-slack-action@v2
47+
if: always()
48+
with:
49+
status: ${{ job.status }}
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
notification_title: "{repo}: {workflow} workflow"
52+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
53+
footer: "<{workflow_url}|View Workflow>"
54+
notify_when: "failure"
55+
env:
56+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
5057
Publish:
5158
runs-on: ubuntu-latest
5259
steps:
@@ -56,10 +63,8 @@ jobs:
5663
with:
5764
distribution: 'temurin'
5865
java-version: '11'
59-
6066
- name: Build with Maven
6167
run: mvn -B package --file pom.xml
62-
6368
- name: Set up Apache Maven Central
6469
uses: actions/setup-java@v2
6570
with:
@@ -70,13 +75,24 @@ jobs:
7075
server-password: MAVEN_CENTRAL_TOKEN
7176
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
7277
gpg-passphrase: MAVEN_GPG_PASSPHRASE
73-
7478
- name: Publish to Apache Maven Central
7579
run: mvn deploy -P sign-artifacts
7680
env:
7781
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
7882
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
7983
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
84+
- name: Slack notification
85+
uses: ravsamhq/notify-slack-action@v2
86+
if: always()
87+
with:
88+
status: ${{ job.status }}
89+
token: ${{ secrets.GITHUB_TOKEN }}
90+
notification_title: "{repo}: {workflow} workflow"
91+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
92+
footer: "<{workflow_url}|View Workflow>"
93+
notify_when: "failure"
94+
env:
95+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
8096
Release:
8197
runs-on: ubuntu-latest
8298
steps:
@@ -94,3 +110,15 @@ jobs:
94110
gh release create "v${{ steps.read_version.outputs.version }}"
95111
env:
96112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
- name: Slack notification
114+
uses: ravsamhq/notify-slack-action@v2
115+
if: always()
116+
with:
117+
status: ${{ job.status }}
118+
token: ${{ secrets.GITHUB_TOKEN }}
119+
notification_title: "{repo}: {workflow} workflow"
120+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
121+
footer: "<{workflow_url}|View Workflow>"
122+
notify_when: "failure"
123+
env:
124+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/issues.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Issues
2+
3+
on:
4+
issues:
5+
types: [opened, closed, reopened]
6+
7+
jobs:
8+
Notify:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Slack notification
13+
uses: slackapi/slack-github-action@v1.23.0
14+
with:
15+
payload: |
16+
{
17+
"text": "*Issue ${{ github.event.issue.state }}*\n\n*Title:* ${{ github.event.issue.title }}\n*Repo:* ${{ github.repository }}\n*<${{ github.event.issue.html_url }}|Issue Link>*"
18+
}
19+
env:
20+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/publish.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ jobs:
3636
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
3737
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
3838
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
39+
40+
- name: Slack notification
41+
uses: ravsamhq/notify-slack-action@v2
42+
if: always()
43+
with:
44+
status: ${{ job.status }}
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
notification_title: "{repo}: {workflow} workflow"
47+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
48+
footer: "<{workflow_url}|View Workflow>"
49+
notify_when: "failure"
50+
env:
51+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ jobs:
2222
gh release create "v${{ steps.read_version.outputs.version }}"
2323
env:
2424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Slack notification
26+
uses: ravsamhq/notify-slack-action@v2
27+
if: always()
28+
with:
29+
status: ${{ job.status }}
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
notification_title: "{repo}: {workflow} workflow"
32+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
33+
footer: "<{workflow_url}|View Workflow>"
34+
notify_when: "failure"
35+
env:
36+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)