-
Notifications
You must be signed in to change notification settings - Fork 249
65 lines (63 loc) · 2.27 KB
/
slack-notify.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# This is a workflow to notify Slack of any relevant activities on Github.
name: Slack Notifications Workflow
# Controls when the action will run.
on:
issues:
types: [opened]
issue_comment:
types: [created]
pull_request:
types: [opened]
release:
types: [published]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
slackNotification:
name: Slack Notifications Job
runs-on: ubuntu-latest
steps:
- name: Issue Slack Notification
if: ${{ github.event_name == 'issues' || (!github.event.issue.pull_request && github.event_name == 'issue_comment') }}
uses: 8398a7/action-slack@v3
with:
status: custom
fields: all
custom_payload: |
{
Type: 'Issue',
Content: `https://github.com/awslabs/aws-solutions-constructs/issues/${{ env.ISSUE_NUMBER }}`
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
- name: PR Slack Notification
if: ${{ github.event_name == 'pull_request' || (github.event.issue.pull_request && github.event_name == 'issue_comment') }}
uses: 8398a7/action-slack@v3
with:
status: custom
fields: all
custom_payload: |
{
Type: 'Pull Request',
Content: `https://github.com/awslabs/aws-solutions-constructs/pull/${{ env.PR_NUMBER }}`
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
PR_NUMBER: ${{ github.event.number }}
- name: Set env
if: ${{ github.event_name == 'release' }}
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Release Slack Notification
if: ${{ github.event_name == 'release' }}
uses: 8398a7/action-slack@v3
with:
status: custom
fields: all
custom_payload: |
{
Version: `${{ env.TAG_NAME }}`,
Content: `https://github.com/awslabs/aws-solutions-constructs/releases/tag/${{ env.TAG_NAME }}`
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_WEBHOOK }}
TAG_NAME: ${{ env.RELEASE_VERSION }}