Skip to content

Commit a15c1b7

Browse files
Release: v0.8.2 (#116)
## What's Changed * Ensure kv parsing returns undefined for empty cases by @sethvargo in #115 **Full Changelog**: v0.8.1...d5b91a3
1 parent d5b91a3 commit a15c1b7

10 files changed

Lines changed: 38 additions & 33 deletions

File tree

dist/index.js

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/kv.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ export declare function joinKVStringForGCloud(input: KVPair, chars?: string): st
2929
*
3030
* @param input String with key/value pairs to parse.
3131
*/
32-
export declare function parseKVString(input: string): KVPair;
32+
export declare function parseKVString(input: string): KVPair | undefined;
3333
/**
3434
* Read and parse an env var file. If the file contents begin with a curly
3535
* brace, the content is assumed to be JSON and is parsed as JSON. Otherwise,
3636
* the contents are parsed as a subset of YAML.
3737
*
3838
* @param filePath Path to the file on disk to parse.
3939
*/
40-
export declare function parseKVFile(filePath: string): KVPair;
40+
export declare function parseKVFile(filePath: string): KVPair | undefined;
4141
/**
4242
* parseKVJSON parses the given string as a set of key=value pairs expressed as
4343
* JSON. If the input is not valid JSON, it errors. If the keys and values are
@@ -51,19 +51,19 @@ export declare function parseKVFile(filePath: string): KVPair;
5151
*
5252
* @return List of key=value pairs.
5353
*/
54-
export declare function parseKVJSON(str: string): KVPair;
54+
export declare function parseKVJSON(str: string): KVPair | undefined;
5555
/**
5656
* Read and parse contents of the string as YAML. This is mostly just exposed
5757
* for testing.
5858
*
5959
* @param str YAML content to parse as K=V pairs.
6060
*/
61-
export declare function parseKVYAML(str: string): KVPair;
61+
export declare function parseKVYAML(str: string): KVPair | undefined;
6262
/**
6363
* parseKVStringAndFile parses the given KV string and KV file, merging the
6464
* results (with kvString taking precedence).
6565
*
6666
* @param kvString String of KEY=VALUE pairs.
6767
* @param kvFilePath Path on disk to a YAML file of KEY: VALUE pairs.
6868
*/
69-
export declare function parseKVStringAndFile(kvString?: string, kvFilePath?: string): KVPair;
69+
export declare function parseKVStringAndFile(kvString?: string, kvFilePath?: string): KVPair | undefined;

docs/kv/functions/parseKVFile.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: parseKVFile()
88

9-
> **parseKVFile**(`filePath`): [`KVPair`](../type-aliases/KVPair.md)
9+
> **parseKVFile**(`filePath`): [`KVPair`](../type-aliases/KVPair.md) \| `undefined`
1010
1111
Read and parse an env var file. If the file contents begin with a curly
1212
brace, the content is assumed to be JSON and is parsed as JSON. Otherwise,
@@ -20,7 +20,7 @@ Path to the file on disk to parse.
2020

2121
## Returns
2222

23-
[`KVPair`](../type-aliases/KVPair.md)
23+
[`KVPair`](../type-aliases/KVPair.md) \| `undefined`
2424

2525
## Source
2626

docs/kv/functions/parseKVJSON.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: parseKVJSON()
88

9-
> **parseKVJSON**(`str`): [`KVPair`](../type-aliases/KVPair.md)
9+
> **parseKVJSON**(`str`): [`KVPair`](../type-aliases/KVPair.md) \| `undefined`
1010
1111
parseKVJSON parses the given string as a set of key=value pairs expressed as
1212
JSON. If the input is not valid JSON, it errors. If the keys and values are
@@ -24,7 +24,7 @@ JSON string to parse.
2424

2525
## Returns
2626

27-
[`KVPair`](../type-aliases/KVPair.md)
27+
[`KVPair`](../type-aliases/KVPair.md) \| `undefined`
2828

2929
List of key=value pairs.
3030

docs/kv/functions/parseKVString.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: parseKVString()
88

9-
> **parseKVString**(`input`): [`KVPair`](../type-aliases/KVPair.md)
9+
> **parseKVString**(`input`): [`KVPair`](../type-aliases/KVPair.md) \| `undefined`
1010
1111
parseKVString parses a string of the format "KEY1=VALUE1,KEY2=VALUE2" or
1212
"KEY1=VALUE1\nKEY2=VALUE2". Keys or values that contain a separator must be
@@ -24,7 +24,7 @@ String with key/value pairs to parse.
2424

2525
## Returns
2626

27-
[`KVPair`](../type-aliases/KVPair.md)
27+
[`KVPair`](../type-aliases/KVPair.md) \| `undefined`
2828

2929
## Source
3030

docs/kv/functions/parseKVStringAndFile.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: parseKVStringAndFile()
88

9-
> **parseKVStringAndFile**(`kvString`?, `kvFilePath`?): [`KVPair`](../type-aliases/KVPair.md)
9+
> **parseKVStringAndFile**(`kvString`?, `kvFilePath`?): [`KVPair`](../type-aliases/KVPair.md) \| `undefined`
1010
1111
parseKVStringAndFile parses the given KV string and KV file, merging the
1212
results (with kvString taking precedence).
@@ -23,8 +23,8 @@ Path on disk to a YAML file of KEY: VALUE pairs.
2323

2424
## Returns
2525

26-
[`KVPair`](../type-aliases/KVPair.md)
26+
[`KVPair`](../type-aliases/KVPair.md) \| `undefined`
2727

2828
## Source
2929

30-
[kv.ts:273](https://github.com/google-github-actions/actions-utils/blob/main/src/kv.ts#L273)
30+
[kv.ts:284](https://github.com/google-github-actions/actions-utils/blob/main/src/kv.ts#L284)

docs/kv/functions/parseKVYAML.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: parseKVYAML()
88

9-
> **parseKVYAML**(`str`): [`KVPair`](../type-aliases/KVPair.md)
9+
> **parseKVYAML**(`str`): [`KVPair`](../type-aliases/KVPair.md) \| `undefined`
1010
1111
Read and parse contents of the string as YAML. This is mostly just exposed
1212
for testing.
@@ -19,8 +19,8 @@ YAML content to parse as K=V pairs.
1919

2020
## Returns
2121

22-
[`KVPair`](../type-aliases/KVPair.md)
22+
[`KVPair`](../type-aliases/KVPair.md) \| `undefined`
2323

2424
## Source
2525

26-
[kv.ts:246](https://github.com/google-github-actions/actions-utils/blob/main/src/kv.ts#L246)
26+
[kv.ts:250](https://github.com/google-github-actions/actions-utils/blob/main/src/kv.ts#L250)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@google-github-actions/actions-utils",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"description": "Helpers and utilities that are shared among Google GitHub Actions",
55
"author": "Google LLC",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)