Skip to content

Commit ef81ea7

Browse files
authored
Merge pull request #80 from mxenabled/mc/slack_notifications
Slack notifications [skip actions]
2 parents 6a6c0ba + 25d472b commit ef81ea7

5 files changed

Lines changed: 92 additions & 7 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 & 7 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 ruby \
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
permissions:
@@ -59,7 +66,6 @@ jobs:
5966
with:
6067
ruby-version: 2.6
6168
- run: bundle install
62-
6369
- name: Publish to RubyGems
6470
run: |
6571
mkdir -p $HOME/.gem
@@ -70,6 +76,18 @@ jobs:
7076
gem push *.gem
7177
env:
7278
RUBY_GEMS_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
79+
- name: Slack notification
80+
uses: ravsamhq/notify-slack-action@v2
81+
if: always()
82+
with:
83+
status: ${{ job.status }}
84+
token: ${{ secrets.GITHUB_TOKEN }}
85+
notification_title: "{repo}: {workflow} workflow"
86+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
87+
footer: "<{workflow_url}|View Workflow>"
88+
notify_when: "failure"
89+
env:
90+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
7391
Release:
7492
runs-on: ubuntu-latest
7593
steps:
@@ -82,9 +100,20 @@ jobs:
82100
- name: Read version
83101
id: read_version
84102
run: echo "::set-output name=version::$(ruby .github/version.rb)"
85-
86103
- name: Create tag and release
87104
run: |
88105
gh release create "v${{ steps.read_version.outputs.version }}"
89106
env:
90107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
- name: Slack notification
109+
uses: ravsamhq/notify-slack-action@v2
110+
if: always()
111+
with:
112+
status: ${{ job.status }}
113+
token: ${{ secrets.GITHUB_TOKEN }}
114+
notification_title: "{repo}: {workflow} workflow"
115+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
116+
footer: "<{workflow_url}|View Workflow>"
117+
notify_when: "failure"
118+
env:
119+
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ jobs:
3030
gem push *.gem
3131
env:
3232
RUBY_GEMS_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
33+
- name: Slack notification
34+
uses: ravsamhq/notify-slack-action@v2
35+
if: always()
36+
with:
37+
status: ${{ job.status }}
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
notification_title: "{repo}: {workflow} workflow"
40+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
41+
footer: "<{workflow_url}|View Workflow>"
42+
notify_when: "failure"
43+
env:
44+
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)