Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 36 additions & 42 deletions .github/workflows/notify-tsc-members-mention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,20 @@ jobs:
SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
# Handling Kit.com notifications
#########
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
working-directory: ./.github/workflows/scripts/kit
- name: Send email with Kit.com
uses: actions/github-script@v7
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
KIT_API_KEY: ${{ secrets.KIT_API_KEY }}
KIT_TSC_TAG_ID: ${{ secrets.KIT_TSC_TAG_ID }}
TITLE: ${{ github.event.issue.title }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
const sendEmail = require('./.github/workflows/scripts/kit/index.js');
sendEmail('${{github.event.issue.html_url}}', process.env.TITLE);

pull_request:
Expand Down Expand Up @@ -103,21 +102,20 @@ jobs:
SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
# Handling Kit.com notifications
#########
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
working-directory: ./.github/workflows/scripts/kit
- name: Send email with Kit.com
uses: actions/github-script@v7
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
KIT_API_KEY: ${{ secrets.KIT_API_KEY }}
KIT_TSC_TAG_ID: ${{ secrets.KIT_TSC_TAG_ID }}
TITLE: ${{ github.event.pull_request.title }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
const sendEmail = require('./.github/workflows/scripts/kit/index.js');
sendEmail('${{github.event.pull_request.html_url}}', process.env.TITLE);

discussion:
Expand Down Expand Up @@ -150,21 +148,20 @@ jobs:
SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
# Handling Kit.com notifications
#########
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
working-directory: ./.github/workflows/scripts/kit
- name: Send email with Kit.com
uses: actions/github-script@v7
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
KIT_API_KEY: ${{ secrets.KIT_API_KEY }}
KIT_TSC_TAG_ID: ${{ secrets.KIT_TSC_TAG_ID }}
TITLE: ${{ github.event.discussion.title }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
const sendEmail = require('./.github/workflows/scripts/kit/index.js');
sendEmail('${{github.event.discussion.html_url}}', process.env.TITLE);

issue_comment:
Expand Down Expand Up @@ -197,21 +194,20 @@ jobs:
SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
# Handling Kit.com notifications
#########
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
working-directory: ./.github/workflows/scripts/kit
- name: Send email with Kit.com
uses: actions/github-script@v7
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
KIT_API_KEY: ${{ secrets.KIT_API_KEY }}
KIT_TSC_TAG_ID: ${{ secrets.KIT_TSC_TAG_ID }}
TITLE: ${{ github.event.issue.title }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
const sendEmail = require('./.github/workflows/scripts/kit/index.js');
sendEmail('${{github.event.comment.html_url}}', process.env.TITLE);

pr_comment:
Expand Down Expand Up @@ -244,21 +240,20 @@ jobs:
SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
# Handling Kit.com notifications
#########
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
working-directory: ./.github/workflows/scripts/kit
- name: Send email with Kit.com
uses: actions/github-script@v7
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
KIT_API_KEY: ${{ secrets.KIT_API_KEY }}
KIT_TSC_TAG_ID: ${{ secrets.KIT_TSC_TAG_ID }}
TITLE: ${{ github.event.issue.title }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
const sendEmail = require('./.github/workflows/scripts/kit/index.js');
sendEmail('${{github.event.comment.html_url}}', process.env.TITLE);

discussion_comment:
Expand Down Expand Up @@ -291,19 +286,18 @@ jobs:
SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
# Handling Kit.com notifications
#########
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
working-directory: ./.github/workflows/scripts/kit
- name: Send email with Kit.com
uses: actions/github-script@v7
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
KIT_API_KEY: ${{ secrets.KIT_API_KEY }}
KIT_TSC_TAG_ID: ${{ secrets.KIT_TSC_TAG_ID }}
TITLE: ${{ github.event.discussion.title }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
const sendEmail = require('./.github/workflows/scripts/kit/index.js');
sendEmail('${{github.event.comment.html_url}}', process.env.TITLE);
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* This code is centrally managed in https://github.com/asyncapi/.github/
* 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
*
* Kit.com version — greeting uses Kit Liquid (subscriber.first_name). Unsubscribe is provided by the Kit email template/footer.
*/
module.exports = (link, title) => {

Expand All @@ -19,7 +21,7 @@ module.exports = (link, title) => {
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>*|MC:SUBJECT|*</title>
<title>${title}</title>

<style type="text/css">
p{
Expand Down Expand Up @@ -348,9 +350,6 @@ module.exports = (link, title) => {

}</style></head>
<body style="background:#FFFFFF none no-repeat center/cover;height: 100%;margin: 0;padding: 0;width: 100%;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: #FFFFFF;background-image: none;background-repeat: no-repeat;background-position: center;background-size: cover;">
<!--*|IF:MC_PREVIEW_TEXT|*-->
<!--[if !gte mso 9]><!----><span class="mcnPreviewText" style="display:none; font-size:0px; line-height:0px; max-height:0px; max-width:0px; opacity:0; overflow:hidden; visibility:hidden; mso-hide:all;">*|MC_PREVIEW_TEXT|*</span><!--<![endif]-->
<!--*|END:IF|*-->
<center>
<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" style="background:#FFFFFF none no-repeat center/cover;border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;height: 100%;margin: 0;padding: 0;width: 100%;background-color: #FFFFFF;background-image: none;background-repeat: no-repeat;background-position: center;background-size: cover;">
<tr>
Expand Down Expand Up @@ -380,7 +379,7 @@ module.exports = (link, title) => {

<td class="mcnTextContent" style="padding-top: 0;padding-right: 18px;padding-bottom: 9px;padding-left: 18px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;word-break: break-word;color: #202020;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: left;" valign="top">

Hey *|FNAME|*,<br>
Hey {{ subscriber.first_name | strip | default: "TSC member" }},<br>
<br>
There is a new topic at AsyncAPI Initiative that requires Technical Steering Committee attention.
<br>
Expand Down Expand Up @@ -459,8 +458,7 @@ AsyncAPI Initiative

<td valign="top" class="mcnTextContent" style="padding-top: 0;padding-right: 18px;padding-bottom: 9px;padding-left: 18px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;word-break: break-word;color: #202020;font-family: Helvetica;font-size: 12px;line-height: 150%;text-align: left;">

Want to change how you receive these emails?<br>
You can <a href="*|UPDATE_PROFILE|*" style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #202020;font-weight: normal;text-decoration: underline;">update your preferences</a> or <a href="*|UNSUB|*" style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #202020;font-weight: normal;text-decoration: underline;">unsubscribe from this list</a>.<br>
You are receiving this email because you are subscribed to TSC Voting notifications.<br>
&nbsp;
</td>
</tr>
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/scripts/kit/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* This code is centrally managed in https://github.com/asyncapi/.github/
* 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
*/
const core = require('@actions/core');
const htmlContent = require('./htmlContent.js');

module.exports = async (link, title) => {
const KIT_BASE = 'https://api.kit.com/v4';
const TSC_TAG_ID = Number(process.env.KIT_TSC_TAG_ID);

// Schedule 1 minute ahead
const sendAt = new Date(Date.now() + 60 * 1000);

const res = await fetch(`${KIT_BASE}/broadcasts`, {
method: 'POST',
headers: {
'X-Kit-Api-Key': process.env.KIT_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
subject: `TSC attention required: ${title}`,
preview_text: 'Check out the latest topic that TSC members have to be aware of',
content: htmlContent(link, title),
description: `TSC notification - ${new Date().toUTCString()}`,
public: false,
published_at: null,
send_at: sendAt.toISOString(),
subscriber_filter: [{ all: [{ type: 'tag', ids: [TSC_TAG_ID] }] }]
})
});

if (!res.ok) return core.setFailed(`Failed creating broadcast: ${await res.text()}`);
core.info(`Kit.com TSC broadcast scheduled for ${sendAt.toISOString()}`);
};
41 changes: 41 additions & 0 deletions .github/workflows/scripts/kit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .github/workflows/scripts/kit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "schedule-email",
"description": "Kit.com email broadcast script for TSC notifications. This file is centrally managed in https://github.com/asyncapi/.github/",
"license": "Apache 2.0",
"dependencies": {
"@actions/core": "1.6.0"
}
}
79 changes: 0 additions & 79 deletions .github/workflows/scripts/mailchimp/index.js

This file was deleted.

Loading
Loading