From 98ed490c6f806e2854ac904255c5fc625d582cb7 Mon Sep 17 00:00:00 2001 From: Kyle Harding Date: Fri, 20 Dec 2024 15:32:49 -0500 Subject: [PATCH] Allow uppercase environment variable creation The current behaviour was to force all variable names to lowercase which was resulting in the wrong behaviour on POST. Instead, just force lowercase when comparing with existing variables. Signed-off-by: Kyle Harding --- lib/plugins/environments.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/plugins/environments.js b/lib/plugins/environments.js index 52a29612..5062503f 100644 --- a/lib/plugins/environments.js +++ b/lib/plugins/environments.js @@ -10,11 +10,7 @@ module.exports = class Environments extends Diffable { // Force all names to lowercase to avoid comparison issues. this.entries.forEach((environment) => { environment.name = environment.name.toLowerCase() - if (environment.variables) { - environment.variables.forEach((variable) => { - variable.name = variable.name.toLowerCase() - }) - } + // Do not force variables to lowercase as they are case-sensitive on create (POST). }) } } @@ -297,11 +293,11 @@ module.exports = class Environments extends Diffable { for (const variable of attrs.variables) { const existingVariable = existingVariables.find( - (_var) => _var.name === variable.name + (_var) => _var.name === variable.name.toLowerCase() ) if (existingVariable) { existingVariables = existingVariables.filter( - (_var) => _var.name === variable.name + (_var) => _var.name !== variable.name.toLowerCase() ) if (existingVariable.value !== variable.value) { await this.github.request(