-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.js
31 lines (24 loc) · 838 Bytes
/
cleanup.js
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
const core = require("@actions/core");
const github = require("@actions/github");
const { SSMClient, TerminateSessionCommand } = require("@aws-sdk/client-ssm");
const run = async () => {
try {
console.log("Terminate SSM Port Forwarding Session");
const client = new SSMClient({region: process.env.AWS_DEFAULT_REGION, customUserAgent: "gha".concat("-",github.context.repo.repo)});
const params = SanitizeInputs();
const command = new TerminateSessionCommand(params);
const data = client.send(command);
console.log("Data %s", data);
} catch (err) {
console.error(err, err.stack);
core.setFailed(err.message);
}
};
function SanitizeInputs() {
const _sessionId = core.getState("session-id");
console.log("Session Id %s", _sessionId);
return {
SessionId: _sessionId,
};
}
run();