-
-
Notifications
You must be signed in to change notification settings - Fork 115
57 lines (51 loc) · 1.85 KB
/
com-dev-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
name: com-dev-notify
on:
issues:
types: [opened]
discussion:
types: [created]
env:
username: ${{ github.event.issue.user.login }}
url: ${{ github.event.issue.html_url }}
org: catalyst-cooperative
jobs:
com-dev-notify:
name: Notify Catalyst of community activity
runs-on: ubuntu-latest
steps:
- name: Get username if a discussion was created
if: ${{ (github.event_name == 'discussion') }}
run: |
echo "username=${{ github.event.discussion.user.login }}" >> $GITHUB_ENV
echo "url=${{ github.event.discussion.html_url }}" >> $GITHUB_ENV
- name: Check if organization member
id: is_organization_member
uses: JamesSingleton/[email protected]
with:
organization: ${{ env.org }}
username: ${{ env.username }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Post to a Slack channel user isn't a part of Catalyst
if: ${{ !steps.is_organization_member.outputs.result }}
id: slack
uses: slackapi/[email protected]
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs.
channel-id: "community-dev"
# For posting a markdown message
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<https://github.com/${{ env.username }}|${{ env.username }}> created ${{ env.url }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.COMMUNITY_DEV_SLACK_BOT_TOKEN }}