Skip to content

Commit 012aebe

Browse files
authored
ci: update generic workflows (#128)
1 parent 5b8cd57 commit 012aebe

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

.github/workflows/notify-tsc-members-mention.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,22 @@ on:
88
issue_comment:
99
types:
1010
- created
11-
- edited
1211

1312
discussion_comment:
1413
types:
1514
- created
16-
- edited
1715

1816
issues:
1917
types:
2018
- opened
21-
- reopened
2219

2320
pull_request_target:
2421
types:
2522
- opened
26-
- reopened
27-
- ready_for_review
2823

2924
discussion:
3025
types:
3126
- created
32-
- edited
3327

3428
jobs:
3529
issue:
@@ -75,7 +69,7 @@ jobs:
7569
with:
7670
script: |
7771
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
78-
sendEmail('${{github.event.issue.html_url}}');
72+
sendEmail('${{github.event.issue.html_url}}', '${{github.event.issue.title}}');
7973
8074
pull_request:
8175
if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.body, '@asyncapi/tsc_members')
@@ -120,7 +114,7 @@ jobs:
120114
with:
121115
script: |
122116
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
123-
sendEmail('${{github.event.pull_request.html_url}}');
117+
sendEmail('${{github.event.pull_request.html_url}}', '${{github.event.pull_request.title}}');
124118
125119
discussion:
126120
if: github.event_name == 'discussion' && contains(github.event.discussion.body, '@asyncapi/tsc_members')
@@ -165,7 +159,7 @@ jobs:
165159
with:
166160
script: |
167161
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
168-
sendEmail('${{github.event.discussion.html_url}}');
162+
sendEmail('${{github.event.discussion.html_url}}', '${{github.event.discussion.title}}');
169163
170164
issue_comment:
171165
if: ${{ github.event_name == 'issue_comment' && !github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') }}
@@ -210,7 +204,7 @@ jobs:
210204
with:
211205
script: |
212206
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
213-
sendEmail('${{github.event.comment.html_url}}');
207+
sendEmail('${{github.event.comment.html_url}}', '${{github.event.issue.title}}');
214208
215209
pr_comment:
216210
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members')
@@ -255,7 +249,7 @@ jobs:
255249
with:
256250
script: |
257251
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
258-
sendEmail('${{github.event.comment.html_url}}');
252+
sendEmail('${{github.event.comment.html_url}}', '${{github.event.issue.title}}');
259253
260254
discussion_comment:
261255
if: github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@asyncapi/tsc_members')
@@ -300,4 +294,4 @@ jobs:
300294
with:
301295
script: |
302296
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
303-
sendEmail('${{github.event.comment.html_url}}');
297+
sendEmail('${{github.event.comment.html_url}}', '${{github.event.discussion.title}}');

.github/workflows/scripts/mailchimp/htmlContent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This code is centrally managed in https://github.com/asyncapi/.github/
33
* Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
44
*/
5-
module.exports = (link) => {
5+
module.exports = (link, title) => {
66

77
return `<!doctype html>
88
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
@@ -386,7 +386,7 @@ There is a new topic at AsyncAPI Initiative that requires Technical Steering Com
386386
<br>
387387
Please have a look if it is just something you need to be aware of, or maybe your vote is needed.
388388
<br>
389-
<a href="${ link }" style="color:#007c89;font-weight:normal;text-decoration:underline" target="_blank">Click here to see more details on GitHub</a>.
389+
Topic: <a href="${ link }" style="color:#007c89;font-weight:normal;text-decoration:underline" target="_blank">${ title }</a>.
390390
</td>
391391
</tr>
392392
</tbody></table>

.github/workflows/scripts/mailchimp/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const htmlContent = require('./htmlContent.js');
1010
* Sending API request to mailchimp to schedule email to subscribers
1111
* Input is the URL to issue/discussion or other resource
1212
*/
13-
module.exports = async (link) => {
13+
module.exports = async (link, title) => {
1414

1515
let newCampaign;
1616

@@ -32,7 +32,7 @@ module.exports = async (link) => {
3232
}
3333
},
3434
settings: {
35-
subject_line: 'AsyncAPI TSC members attention required',
35+
subject_line: `TSC attention required: ${ title }`,
3636
preview_text: 'Check out the latest topic that TSC members have to be aware of',
3737
title: `New topic info - ${ new Date(Date.now()).toUTCString()}`,
3838
from_name: 'AsyncAPI Initiative',
@@ -47,7 +47,7 @@ module.exports = async (link) => {
4747
* Content of the email is added separately after campaign creation
4848
*/
4949
try {
50-
await mailchimp.campaigns.setContent(newCampaign.id, { html: htmlContent(link) });
50+
await mailchimp.campaigns.setContent(newCampaign.id, { html: htmlContent(link, title) });
5151
} catch (error) {
5252
return core.setFailed(`Failed adding content to campaign: ${ JSON.stringify(error) }`);
5353
}

0 commit comments

Comments
 (0)