forked from CGAL/cgal
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.41 KB
/
wiki_notification.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
32
33
34
35
36
37
38
name: Wiki Notification
on: gollum
jobs:
prepare_email:
runs-on: ubuntu-latest
outputs:
messages: ${{ steps.set-result.outputs.result }}
steps:
- name: get informations and prepare email
uses: actions/github-script@v6
id: set-result
with:
result-encoding: string
script: |
const payload = context.payload;
const actor = payload.sender;
const pages = payload.pages;
let messages = "Subject:Updates to CGAL Wiki \nContent-Type: text/html\n";
messages += "<html><body>";
messages += `<p>The following CGAL Wiki page were modified by <a href="${actor.html_url}">"${actor.login}"</a>:</p><ul>\n`
for (const page of pages){
messages += `<li><a href="${page.html_url}">${page.title}</a> (link to <a href="${page.html_url}/_compare/${page.sha}%5E...${page.sha}">the diff</a>)</li>\n`;
}
messages += "</ul></body></html>";
console.log( messages );
return messages;
call_send_email:
needs: prepare_email
uses: ./.github/workflows/send_email.yml
with:
message: ${{needs.prepare_email.outputs.messages}}
secrets:
email: ${{ secrets.CGAL_SEND_WIKI_EMAIL_TO }}
private_key: ${{ secrets.CGAL_SEND_WIKI_EMAIL_SSH_PRIVATE_KEY }}
user: ${{ secrets.CGAL_SEND_WIKI_EMAIL_SSH_USER }}
host: ${{ secrets.CGAL_SEND_WIKI_EMAIL_SSH_HOST }}