Skip to content

Commit b3370fe

Browse files
committed
rename setVariable function to createVariable + minor refactor
1 parent 0dfab85 commit b3370fe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/lib/gitlab-ci.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ export default function gitlabCI(url, token) {
3737
}
3838

3939
/**
40-
* Set project variable
40+
* Create project variable
4141
*
4242
* @param key
4343
* @param value
4444
*
4545
* @return {Promise<Object>} variable object
4646
*/
47-
async function setVariable(key, value) {
47+
async function createVariable(key, value) {
4848
const response = await axios({
4949
method: 'post',
5050
url: `${apiUrl}?${tokenQueryString}`,
@@ -107,7 +107,7 @@ export default function gitlabCI(url, token) {
107107

108108
const promises = keysToSet.map(async (key) => {
109109
const value = properties[key];
110-
const keyExists = existingKeys.some(existingKey => existingKey === key);
110+
const keyExists = existingKeys.includes(key);
111111

112112
if (keyExists && !forceUpdate) {
113113
console.log(`Skipping ${key}, already set for ${projectId}.`);
@@ -120,7 +120,7 @@ export default function gitlabCI(url, token) {
120120
variable = await updateVariable(key, value);
121121
} else {
122122
// Create variable
123-
variable = await setVariable(key, value);
123+
variable = await createVariable(key, value);
124124
}
125125

126126
console.log(`Set ${key} = ${JSON.stringify(value)} for ${projectId}`);
@@ -133,7 +133,7 @@ export default function gitlabCI(url, token) {
133133
}
134134

135135
return {
136-
setVariable,
136+
createVariable,
137137
updateVariable,
138138
listVariables,
139139
setVariables,

0 commit comments

Comments
 (0)