Skip to content

Commit 1aa6e08

Browse files
committed
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 <[email protected]>
1 parent 92f3586 commit 1aa6e08

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/plugins/environments.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ module.exports = class Environments extends Diffable {
1010
// Force all names to lowercase to avoid comparison issues.
1111
this.entries.forEach((environment) => {
1212
environment.name = environment.name.toLowerCase()
13-
if (environment.variables) {
14-
environment.variables.forEach((variable) => {
15-
variable.name = variable.name.toLowerCase()
16-
})
17-
}
13+
// Do not force variables to lowercase as they are case-sensitive on create (POST).
1814
})
1915
}
2016
}
@@ -297,11 +293,11 @@ module.exports = class Environments extends Diffable {
297293

298294
for (const variable of attrs.variables) {
299295
const existingVariable = existingVariables.find(
300-
(_var) => _var.name === variable.name
296+
(_var) => _var.name === variable.name.toLowerCase()
301297
)
302298
if (existingVariable) {
303299
existingVariables = existingVariables.filter(
304-
(_var) => _var.name === variable.name
300+
(_var) => _var.name !== variable.name.toLowerCase()
305301
)
306302
if (existingVariable.value !== variable.value) {
307303
await this.github.request(

0 commit comments

Comments
 (0)