Skip to content

Commit 4282b37

Browse files
committed
chore: added possibility to use prefixed envs as parameter overrides
1 parent 18f144d commit 4282b37

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

dist/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ let clientConfiguration = {
227227
customUserAgent: 'aws-cloudformation-github-deploy-for-github-actions'
228228
};
229229
function run() {
230+
var _a;
230231
return __awaiter(this, void 0, void 0, function* () {
231232
try {
232233
const { GITHUB_WORKSPACE = __dirname } = process.env;
@@ -242,6 +243,9 @@ function run() {
242243
const parameterOverrides = core.getInput('parameter-overrides', {
243244
required: false
244245
});
246+
const envsPrefixForparameterOverrides = core.getInput('envs-prefix-for-parameter-overrides', {
247+
required: false
248+
});
245249
const noEmptyChangeSet = !!+core.getInput('no-fail-on-empty-changeset', {
246250
required: false
247251
});
@@ -316,7 +320,15 @@ function run() {
316320
if (parameterOverrides) {
317321
params.Parameters = (0, utils_1.parseParameters)(parameterOverrides.trim());
318322
}
319-
const stackId = yield (0, deploy_1.deployStack)(cfn, params, changeSetName ? changeSetName : `${params.StackName}-CS`, noEmptyChangeSet, noExecuteChangeSet, noDeleteFailedChangeSet);
323+
if (envsPrefixForparameterOverrides.length > 0) {
324+
(_a = params.Parameters) === null || _a === void 0 ? void 0 : _a.concat(Object.keys(process.env)
325+
.filter(key => key.startsWith(envsPrefixForparameterOverrides))
326+
.map(key => ({
327+
ParameterKey: key,
328+
ParameterValue: process.env[key]
329+
})));
330+
}
331+
const stackId = yield (0, deploy_1.deployStack)(cfn, params, noEmptyChangeSet, noExecuteChangeSet, noDeleteFailedChangeSet);
320332
core.setOutput('stack-id', stackId || 'UNKNOWN');
321333
if (stackId) {
322334
const outputs = yield (0, deploy_1.getStackOutputs)(cfn, stackId);

0 commit comments

Comments
 (0)