Skip to content

Commit 176d5cd

Browse files
committed
Added 'sendgrid_sender_id' input to render-newsletter action
1 parent 920a644 commit 176d5cd

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

.github/actions/render-newsletter/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ inputs:
2222
sendgrid_list_id:
2323
description: 'SendGrid contacts list to send the newsletter to'
2424
required: false
25+
sendgrid_sender_id:
26+
description: 'Verified sender id'
27+
required: false
2528
suppression_group_id:
2629
description: ''
2730
required: false

.github/actions/render-newsletter/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/render-newsletter/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Options = {
5454
template?: string,
5555
context?: any,
5656
listId?: string,
57+
senderId?: number,
5758
suppressionGroupId?: number,
5859
siteYaml?: string,
5960
subject?: string,
@@ -291,6 +292,8 @@ async function runAction() {
291292
const {
292293
INPUT_SENDGRID_LIST_ID: listId,
293294
INPUT_SENDGRID_API_KEY: apiKey,
295+
INPUT_SENDGRID_SENDER_ID: senderId,
296+
294297
INPUT_TEMPLATE_PATH: template,
295298
INPUT_TEXT_PATH: path,
296299
INPUT_CONTEXT: context,
@@ -317,6 +320,7 @@ async function runAction() {
317320
output: outPath,
318321
context: context ? JSON.parse(context) : {},
319322
listId: listId,
323+
senderId: senderId ? parseInt(senderId) : undefined,
320324
suppressionGroupId: suppressionGroupId ? parseInt(suppressionGroupId) : undefined,
321325
siteYaml,
322326
subject,
@@ -335,6 +339,7 @@ async function testRun() {
335339
process.env['INPUT_SUPPRESSION_GROUP_ID'] = '17889';
336340
process.env['INPUT_SITE_YAML'] = __dirname + '/../../../../_config.yml';
337341

342+
338343
await runAction();
339344
}
340345

.github/actions/render-newsletter/src/sendgrid.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const API_BASE = 'https://api.sendgrid.com/v3';
2020
type SingleSendParams = {
2121
html: string,
2222
listId: string,
23+
senderId?: number,
2324
suppressionGroup: number,
2425
token: string,
2526
sendAt?: Date,
@@ -47,7 +48,8 @@ export async function singleSend(params: SingleSendParams) {
4748
email_config: {
4849
subject: params.subject,
4950
html_content: params.html,
50-
suppression_group_id: params.suppressionGroup
51+
suppression_group_id: params.suppressionGroup,
52+
sender_id: params.senderId || null,
5153
}
5254
})
5355
});
@@ -143,3 +145,12 @@ export async function cleanup(params: GetSingleSendsParams) {
143145
}
144146
}
145147
}
148+
149+
export async function verifiedSenders({ token } : { token: string }) {
150+
return await fetch(`${API_BASE}/verified_senders`, {
151+
method: 'GET',
152+
headers: {
153+
'Authorization': `Bearer ${token}`
154+
}
155+
});
156+
}

0 commit comments

Comments
 (0)