There are people who use github to create issues and PRs for bug
reporting and patch submitting, but there is no notifications to crash
maintainers as well as the mailing list, which as a result, leaving the
issues and PRs unhandled.
This patch will add an email notification action for github repo, when
new issues and PRs created or received comments, it will send email for
notification.
The format of the email notification is as follows:
Title: <Issue or PR title>
Description: <Issue or PR description>
Link: <Url to the issue or PR>
========
<Url to the comment or patch if any>
<Content of the comment or patch if any>
Please note:
1) Currently the email notification won't be sent to crash
mailing list, but only the maintainers, in case the notification is not
mature and pollute the mailing list. We can enable it later when it is
good enough.
2) The notification won't receive any reply, so
reply to the notification for comments and patch review is not
supported.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
.github/workflows/email_notify.yml | 45 ++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 .github/workflows/email_notify.yml
diff --git a/.github/workflows/email_notify.yml b/.github/workflows/email_notify.yml
new file mode 100644
index 0000000..475361b
--- /dev/null
+++ b/.github/workflows/email_notify.yml
@@ -0,0 +1,45 @@
+name: Notify Issues and PRs
+on:
+ issues:
+ types: [opened]
+ issue_comment:
+ types: [created]
+ pull_request:
+ branches: ["master"]
+ types: [opened, reopened]
+
+jobs:
+ notify:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Generate Email
+ run: |
+ TITLE="${{ github.event.issue.title || github.event.pull_request.title
}}"
+ LINK="${{ github.event.issue.html_url ||
github.event.pull_request.html_url }}"
+ DESC="${{ github.event.issue.body || github.event.pull_request.body
}}"
+ PT_URL="${{ github.event.pull_request.patch_url }}"
+ COMT="${{ github.event.comment.body }}"
+ COMT_URL="${{ github.event.comment.html_url }}"
+ EVENT_ACT="${{ github.event.action }}"
+ echo "Title: $TITLE" > /tmp/body.txt
+ echo "Description: $DESC" >> /tmp/body.txt
+ echo "Link: $LINK" >> /tmp/body.txt
+ [[ -n "$PT_URL" ]] && echo "========" >>
/tmp/body.txt \
+ && echo "Patch: $PT_URL" >>
/tmp/body.txt \
+ && curl -L "$PT_URL" >>
/tmp/body.txt
+ [[ -n "$COMT" ]] && echo "========" >>
/tmp/body.txt \
+ && echo "Comment: $COMT_URL" >>
/tmp/body.txt \
+ && echo "Comment: $COMT" >>
/tmp/body.txt
+ [[ "$EVENT_ACT" == "created" ]] && echo
"Comment on Issue/PR: $TITLE" > /tmp/subj.txt \
+ || echo "New Issue/PR: $TITLE" >
/tmp/subj.txt
+ - name: Send Email
+ uses: dawidd6/action-send-mail@v3
+ with:
+ server_address:
smtp.gmail.com
+ server_port: 465
+ username: ${{ secrets.EMAIL_USER }}
+ password: ${{ secrets.EMAIL_PASS }}
+ subject: file:///tmp/subj.txt
+ body: file:///tmp/body.txt
+ to: "ltao(a)redhat.com, lijiang(a)redhat.com"
+ from: "Crash Github Bot - NO REPLY"
--
2.47.0