-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action for sending notification to Slack
- Loading branch information
mj52951
committed
Mar 25, 2024
1 parent
6e03528
commit 697973f
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |