Skip to content

Commit 831d472

Browse files
committed
move request slack invite to netlify
1 parent d9475d5 commit 831d472

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

api_requestSlackInvite/function.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

api_requestSlackInvite/index.js

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
const Archetype = require('archetype');
4+
const extrovert = require('extrovert');
5+
const requestInvite = require('../src/actions/requestInvite');
6+
7+
const RequestSlackInviteParams = new Archetype({
8+
email: {
9+
$type: 'string',
10+
$required: true
11+
}
12+
}).compile('RequestSlackInviteParams');
13+
14+
module.exports = extrovert.toNetlifyFunction(async function requestSlackInvite(params) {
15+
const { email } = new RequestSlackInviteParams(params);
16+
return await requestInvite()(email);
17+
});

netlify/functions/webhookGitHubComment.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const Archetype = require('archetype');
34
const axios = require('axios');
45
const createReleaseFromChangelog = require('../../src/actions/createReleaseFromChangelog');
56
const { createTokenAuth } = require('@octokit/auth-token');
@@ -10,6 +11,25 @@ const ignoreUsers = new Set((process.env.IGNORE_GITHUB_USERS || '').split(','));
1011
const githubAccessTokenForMongoose = process.env.GITHUB_ACCESS_TOKEN_FOR_MONGOOSE;
1112
const slackToken = process.env.SLACK_TOKEN;
1213

14+
const WebhookGitHubCommentParams = new Archetype({
15+
action: {
16+
$type: 'string',
17+
$required: true
18+
},
19+
issue: {
20+
$type: Archetype.Any
21+
},
22+
sender: {
23+
$type: Archetype.Any
24+
},
25+
ref: {
26+
$type: 'string'
27+
},
28+
ref_type: {
29+
$type: 'string'
30+
}
31+
}).compile('WebhookGitHubCommentParams');
32+
1333
module.exports = extrovert.toNetlifyFunction(async function webhookGitHubComment(params) {
1434
const conn = await connect();
1535
const Subscriber = conn.model('Subscriber');

0 commit comments

Comments
 (0)