-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (28 loc) · 724 Bytes
/
index.js
File metadata and controls
35 lines (28 loc) · 724 Bytes
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
const core = require("@actions/core");
const fs = require("fs");
const {
LambdaClient,
UpdateFunctionCodeCommand,
} = require("@aws-sdk/client-lambda");
async function run() {
let region = core.getInput("region");
let zip = core.getInput("zip");
let functionName = core.getInput("functionName");
let zipBuffer = fs.readFileSync(zip);
let client = new LambdaClient({ region });
let params = {
FunctionName: functionName,
Publish: true,
ZipFile: zipBuffer,
};
let command = new UpdateFunctionCodeCommand(params);
await client.send(command);
}
(async function () {
try {
await run();
} catch (error) {
core.error(error.message);
core.setFailed(error.message);
}
})();