-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (29 loc) · 901 Bytes
/
index.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
32
33
34
const core = require('@actions/core');
const AWS = require('aws-sdk');
const run_action = async () => {
try {
const applicationName = core.getInput('ssm-application-name', { required: true });
AWS.config.update({ region: process.env.AWS_DEFAULT_REGION });
const ssm = new AWS.SSM();
for (const [variable, value] of Object.entries(process.env)) {
if (variable.startsWith('AWS_')) {
core.debug(`Skipping AWS paramter ${variable}`);
} else if (typeof value !== 'string' || value.length === 0) {
core.debug(`Skipping empty / non-string variable ${variable}`);
} else {
core.debug(`Putting parameter ${variable}`);
await ssm
.putParameter({
Name: `/${applicationName}/temp/${variable}`,
Value: value,
Type: 'SecureString',
Overwrite: true,
})
.promise();
}
}
} catch (e) {
core.setFailed(e.message);
}
};
run_action();