Skip to content

Commit 697973f

Browse files
author
mj52951
committed
Action for sending notification to Slack
1 parent 6e03528 commit 697973f

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Send notification"
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
send_notification:
9+
runs-on: ubuntu-latest
10+
if: github.event.pull_request.merged == true
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Get changed files
19+
id: changed-files
20+
uses: tj-actions/changed-files@v32
21+
22+
- name: Check if mainnet was changed
23+
if: contains(steps.changed-files.outputs.all_changed_files, 'shared-config-mainnet.json')
24+
run: |
25+
echo "mainnet_changed=true" >> $GITHUB_ENV
26+
27+
- name: Send Slack notification for mainnet
28+
uses: slackapi/[email protected]
29+
if: ${{ env.mainnet_changed }}
30+
with:
31+
payload: |
32+
{
33+
"environment": "MAINNET",
34+
"pr_url": "${{ github.event.pull_request.html_url }}"
35+
}
36+
env:
37+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
38+
39+
- name: Check if testnet was changed
40+
if: contains(steps.changed-files.outputs.all_changed_files, 'shared-config-test.json')
41+
run: |
42+
echo "testnet_changed=true" >> $GITHUB_ENV
43+
44+
- name: Send Slack notification for testnet
45+
uses: slackapi/[email protected]
46+
if: ${{ env.testnet_changed }}
47+
with:
48+
payload: |
49+
{
50+
"environment": "TESTNET",
51+
"pr_url": "${{ github.event.pull_request.html_url }}"
52+
}
53+
env:
54+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)