Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature skip empty value #27

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ This action helps solve this problem by allowing the user to provide the path an

**Optional** The AWS KMS Key ARN to use to encrypt the key. Default uses the AWS Provided KMS Key ID .

### `skip-empty-value`

**Optional** When true - Skips creating/updating an SSM Parameter if provided value is empty. Default set to false.


## Example usage

```yaml
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inputs:
ssm-kms-key-id:
description: "The AWS KMS Key ARN to use to encrypt the key"
default: ""
skip-empty-value:
description: "Skips creating/updating an SSM Parameter if provided value is empty"
default: ""
runs:
using: "node16"
main: "index.js"
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ async function run() {
apiVersion: "2014-11-06",
region: core.getInput("aws-region"),
});
var skip = core.getInput("skip-empty-value", { required: false });
var params = {
Name: core.getInput("ssm-path", { required: true }),
Value: core.getInput("ssm-value", { required: true }),
Value: core.getInput("ssm-value", { required: !skip }),
Type: core.getInput("ssm-value-type", { required: true }),
Overwrite: core.getBooleanInput("ssm-value-overwrite", {
required: true,
}),
Description: core.getInput("ssm-value-description"),
};
if (skip === 'true' && params.Value === '') {
core.info(`Skipping empty value parameter in path [${ssm_path}]`);
return;
}
core.debug(
`Prepared parameters for SSM parameter update. ${JSON.stringify(params)}`
);
Expand Down