forked from NethermindEth/nethermind
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (29 loc) · 1.04 KB
/
alert-on-issue-open-event.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
name: '[ALERT] When issue is opened by an external contributor'
on:
issues:
types: opened
jobs:
alert-team:
if: github.repository_owner == 'NethermindEth'
name: Alert team about an issue reported by users
runs-on: ubuntu-latest
env:
USER: ${{ github.event.issue.user.login }}
AUTHOR_ASSOCIATION: ${{ github.event.issue.author_association }}
ISSUE_URL: ${{ github.event.issue.html_url }}
steps:
- name: Alert Nethermind Team
if: ${{ env.AUTHOR_ASSOCIATION == 'NONE' }}
run: |
MESSAGE="An issue has been created by an user: $USER"
MESSAGE_FORMATTED=$(echo $MESSAGE | tr -d '"')
composeMessage() {
cat <<EOF
{
"message": "$MESSAGE_FORMATTED",
"description":"Github issue URL: $ISSUE_URL",
"tags": ["GithubIssues"]
}
EOF
}
curl -s -X POST https://api.eu.opsgenie.com/v2/alerts -H "Content-Type: application/json" -H "Authorization: GenieKey ${{ secrets.OPSGENIE_API_KEY }}" -d "$(composeMessage)"