-
Notifications
You must be signed in to change notification settings - Fork 87
40 lines (37 loc) · 1.45 KB
/
on-community-issue.yaml
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
name: "Slack Notification on Community Issue"
on:
push:
issues:
types: [opened, labeled]
jobs:
label-check:
runs-on: ubuntu-latest
steps:
- name: Check if organization member
id: is_organization_member
run: |
http_status=$(curl -o /dev/null -s -w '%{http_code}' "Authorization: Bearer ${{ secrets.ORG_READ_GITHUB_TOKEN }}" https://api.github.com/orgs/tenstorrent/members/${{ github.event.issue.user.login }})
if [ "$http_status" -eq 204 ]; then
echo "is_member=true" >> $GITHUB_OUTPUT
else
echo "is_member=false" >> $GITHUB_OUTPUT
fi
- name: Add community label
if: ${{ steps.is_organization_member.outputs.result == 'false' }}
run: gh issue edit "$NUMBER" --add-label "$LABELS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
LABELS: community
- name: Send Slack Notification
if: ${{ steps.is_organization_member.outputs.result == 'false' }}
uses: slackapi/[email protected]
with:
payload: |
{
"text": "A new issue has been created by a non-org member `${{ github.event.sender.login }}`: ${{ github.event.issue.html_url }}",
"channel": "C07AZJ5DLL8"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CHANNEL_WEBHOOK_URL }}