@@ -363967,13 +363967,16 @@ class CloudFunction {
363967
363967
// Parse env vars
363968
363968
let envVars;
363969
363969
if (opts === null || opts === void 0 ? void 0 : opts.envVars) {
363970
- envVars = this.parseEnvVars (opts.envVars);
363970
+ envVars = this.parseKVPairs (opts.envVars);
363971
363971
request.environmentVariables = envVars;
363972
363972
}
363973
363973
if (opts === null || opts === void 0 ? void 0 : opts.envVarsFile) {
363974
363974
envVars = this.parseEnvVarsFile(opts.envVarsFile);
363975
363975
request.environmentVariables = envVars;
363976
363976
}
363977
+ if (opts === null || opts === void 0 ? void 0 : opts.labels) {
363978
+ request.labels = this.parseKVPairs(opts.labels);
363979
+ }
363977
363980
this.request = request;
363978
363981
this.name = opts.name;
363979
363982
this.sourceDir = opts.sourceDir ? opts.sourceDir : './';
@@ -363987,22 +363990,22 @@ class CloudFunction {
363987
363990
this.request.sourceUploadUrl = sourceUrl;
363988
363991
}
363989
363992
/**
363990
- * Parses a string of the format `KEY1=VALUE1`.
363993
+ * Parses a string of the format `KEY1=VALUE1,KEY2=VALUE2 `.
363991
363994
*
363992
- * @param envVarInput Env var string to parse.
363995
+ * @param values String with key/value pairs to parse.
363993
363996
* @returns map of type {KEY1:VALUE1}
363994
363997
*/
363995
- parseEnvVars(envVarInput ) {
363996
- const envVarList = envVarInput .split(',');
363997
- const envVars = {};
363998
- envVarList .forEach((envVar ) => {
363999
- if (!envVar .includes('=')) {
364000
- throw new TypeError(`Env Vars must be in "KEY1=VALUE1,KEY2=VALUE2" format, received ${envVar} `);
364001
- }
364002
- const keyValue = envVar .split('=');
364003
- envVars [keyValue[0]] = keyValue[1];
363998
+ parseKVPairs(values ) {
363999
+ const valuePairs = values .split(',');
364000
+ const kvPairs = {};
364001
+ valuePairs .forEach((pair ) => {
364002
+ if (!pair .includes('=')) {
364003
+ throw new TypeError(`The expected data format should be "KEY1=VALUE1", got "${pair}" while parsing "${values}" `);
364004
+ }
364005
+ const keyValue = pair .split('=');
364006
+ kvPairs [keyValue[0]] = keyValue[1];
364004
364007
});
364005
- return envVars ;
364008
+ return kvPairs ;
364006
364009
}
364007
364010
/**
364008
364011
* Read and parse an env var file.
@@ -364261,6 +364264,7 @@ class CloudFunctionClient {
364261
364264
'eventTrigger.eventType',
364262
364265
'eventTrigger.resource',
364263
364266
'eventTrigger.service',
364267
+ 'labels',
364264
364268
];
364265
364269
const updateFunctionRequest = {
364266
364270
updateMask: updateMasks.join(','),
@@ -364434,6 +364438,7 @@ function run() {
364434
364438
const eventTriggerType = core.getInput('event_trigger_type');
364435
364439
const eventTriggerResource = core.getInput('event_trigger_resource');
364436
364440
const eventTriggerService = core.getInput('event_trigger_service');
364441
+ const labels = core.getInput('labels');
364437
364442
// Create Cloud Functions client
364438
364443
const client = new cloudFunctionClient_1.CloudFunctionClient(region, { projectId, credentials });
364439
364444
// Create Function definition
@@ -364453,6 +364458,7 @@ function run() {
364453
364458
eventTriggerService,
364454
364459
vpcConnector,
364455
364460
serviceAccountEmail,
364461
+ labels,
364456
364462
});
364457
364463
// Deploy function
364458
364464
const deployFunctionResponse = yield client.deploy(newFunc);
0 commit comments