Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Eden Zimbelman <[email protected]>
58 lines
2.3 KiB
YAML
58 lines
2.3 KiB
YAML
# 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/[email protected]
|
|
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/[email protected]
|
|
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/[email protected]
|
|
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/[email protected]
|
|
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 }}
|