Skip to content

Commit

Permalink
Action for sending notification to Slack
Browse files Browse the repository at this point in the history
  • Loading branch information
mj52951 committed Apr 8, 2024
1 parent ee024ee commit 9b3aac3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/send-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Send notification"

on:
pull_request:
types: [closed]

jobs:
send_notification:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v32

- name: Check if mainnet was changed
if: contains(steps.changed-files.outputs.all_changed_files, 'shared-config-mainnet.json')
run: |
echo "mainnet_changed=true" >> $GITHUB_ENV
- name: Send Slack notification for mainnet
uses: slackapi/[email protected]
if: ${{ env.mainnet_changed }}
with:
payload: |
{
"environment": "MAINNET",
"pr_url": "${{ github.event.pull_request.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Check if testnet was changed
if: contains(steps.changed-files.outputs.all_changed_files, 'shared-config-test.json')
run: |
echo "testnet_changed=true" >> $GITHUB_ENV
- name: Send Slack notification for testnet
uses: slackapi/[email protected]
if: ${{ env.testnet_changed }}
with:
payload: |
{
"environment": "TESTNET",
"pr_url": "${{ github.event.pull_request.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit 9b3aac3

Please sign in to comment.