-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathinvite.yml
More file actions
57 lines (52 loc) · 2.27 KB
/
invite.yml
File metadata and controls
57 lines (52 loc) · 2.27 KB
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Invite a usergroup to channel
on:
issues:
types:
- labeled
jobs:
run:
name: Respond to reports of a new problem
runs-on: ubuntu-latest
if: ${{ github.event.label.name == 'bug' }}
steps:
- name: Create a new Slack channel for communications
id: conversation
uses: slackapi/slack-github-action@v3.0.1
with:
errors: true
method: conversations.create # https://docs.slack.dev/reference/methods/conversations.create/
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
name: issue-${{ github.event.issue.number }}
- name: Send the issue link into the Slack channel
uses: slackapi/slack-github-action@v3.0.1
with:
errors: true
method: chat.postMessage # https://docs.slack.dev/reference/methods/chat.postMessage/
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ steps.conversation.outputs.channel_id }}
text: "An issue was opened <!date^${{ steps.conversation.outputs.time }}^{date_num} at {time_secs}|just now>: ${{ github.event.issue.html_url }}"
- name: Gather information of those to add
id: members
uses: slackapi/slack-github-action@v3.0.1
with:
errors: true
method: usergroups.users.list # https://docs.slack.dev/reference/methods/usergroups.users.list/
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
usergroup: ${{ secrets.SLACK_USERGROUP_ID }}
- name: Combine the list of usergroup users
run: |
SLACK_USERGROUP_USER_IDS=$(echo '${{ steps.members.outputs.response }}' | jq -r '.users | join(",")' )
echo "SLACK_USERGROUP_USER_IDS=$SLACK_USERGROUP_USER_IDS" >> $GITHUB_ENV
- name: Add the usergroup to the channel
uses: slackapi/slack-github-action@v3.0.1
with:
errors: true
method: conversations.invite # https://docs.slack.dev/reference/methods/conversations.invite/
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ steps.conversation.outputs.channel_id }}
users: ${{ env.SLACK_USERGROUP_USER_IDS }}