You've already forked dynamic-badges-action
🔧 Handle optional parameters
This commit is contained in:
32
index.js
32
index.js
@@ -20,44 +20,44 @@ try {
|
|||||||
const cacheSeconds = core.getInput('cache-seconds');
|
const cacheSeconds = core.getInput('cache-seconds');
|
||||||
|
|
||||||
|
|
||||||
if (labelColor != undefined) {
|
if (labelColor != '') {
|
||||||
description.labelColor = labelColor;
|
description.labelColor = labelColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color != undefined) {
|
if (color != '') {
|
||||||
description.labelColor = color;
|
description.labelColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isError != undefined) {
|
if (isError != '') {
|
||||||
description.isError = isError;
|
description.isError = isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (namedLogo != undefined) {
|
if (namedLogo != '') {
|
||||||
description.namedLogo = namedLogo;
|
description.namedLogo = namedLogo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logoSvg != undefined) {
|
if (logoSvg != '') {
|
||||||
description.logoSvg = logoSvg;
|
description.logoSvg = logoSvg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logoColor != undefined) {
|
if (logoColor != '') {
|
||||||
description.logoColor = logoColor;
|
description.logoColor = logoColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logoWidth != undefined) {
|
if (logoWidth != '') {
|
||||||
description.logoWidth = logoWidth;
|
description.logoWidth = parseInt(logoWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logoPosition != undefined) {
|
if (logoPosition != '') {
|
||||||
description.logoPosition = logoPosition;
|
description.logoPosition = logoPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style != undefined) {
|
if (style != '') {
|
||||||
description.style = style;
|
description.style = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheSeconds != undefined) {
|
if (cacheSeconds != '') {
|
||||||
description.cacheSeconds = cacheSeconds;
|
description.cacheSeconds = parseInt(cacheSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = {files: {}};
|
let data = {files: {}};
|
||||||
@@ -66,9 +66,6 @@ try {
|
|||||||
};
|
};
|
||||||
data = JSON.stringify(data);
|
data = JSON.stringify(data);
|
||||||
|
|
||||||
console.log('test 0');
|
|
||||||
|
|
||||||
|
|
||||||
const req = http.request(
|
const req = http.request(
|
||||||
{
|
{
|
||||||
host: 'api.github.com',
|
host: 'api.github.com',
|
||||||
@@ -82,7 +79,6 @@ try {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
res => {
|
res => {
|
||||||
console.log('foooo!');
|
|
||||||
let body = '';
|
let body = '';
|
||||||
|
|
||||||
res.on('data', data => {
|
res.on('data', data => {
|
||||||
@@ -94,13 +90,9 @@ try {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('test 1');
|
|
||||||
req.write(data);
|
req.write(data);
|
||||||
console.log('test 2');
|
|
||||||
req.end();
|
req.end();
|
||||||
|
|
||||||
console.log('test 3');
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error);
|
core.setFailed(error);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user