Skip to content

Commit

Permalink
Allow uppercase environment variable creation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
klutchell committed Dec 26, 2024
1 parent 92f3586 commit d46d969
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/plugins/environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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).
})
}
}
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d46d969

Please sign in to comment.