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');
|
||||
|
||||
|
||||
if (labelColor != undefined) {
|
||||
if (labelColor != '') {
|
||||
description.labelColor = labelColor;
|
||||
}
|
||||
|
||||
if (color != undefined) {
|
||||
if (color != '') {
|
||||
description.labelColor = color;
|
||||
}
|
||||
|
||||
if (isError != undefined) {
|
||||
if (isError != '') {
|
||||
description.isError = isError;
|
||||
}
|
||||
|
||||
if (namedLogo != undefined) {
|
||||
if (namedLogo != '') {
|
||||
description.namedLogo = namedLogo;
|
||||
}
|
||||
|
||||
if (logoSvg != undefined) {
|
||||
if (logoSvg != '') {
|
||||
description.logoSvg = logoSvg;
|
||||
}
|
||||
|
||||
if (logoColor != undefined) {
|
||||
if (logoColor != '') {
|
||||
description.logoColor = logoColor;
|
||||
}
|
||||
|
||||
if (logoWidth != undefined) {
|
||||
description.logoWidth = logoWidth;
|
||||
if (logoWidth != '') {
|
||||
description.logoWidth = parseInt(logoWidth);
|
||||
}
|
||||
|
||||
if (logoPosition != undefined) {
|
||||
if (logoPosition != '') {
|
||||
description.logoPosition = logoPosition;
|
||||
}
|
||||
|
||||
if (style != undefined) {
|
||||
if (style != '') {
|
||||
description.style = style;
|
||||
}
|
||||
|
||||
if (cacheSeconds != undefined) {
|
||||
description.cacheSeconds = cacheSeconds;
|
||||
if (cacheSeconds != '') {
|
||||
description.cacheSeconds = parseInt(cacheSeconds);
|
||||
}
|
||||
|
||||
let data = {files: {}};
|
||||
@@ -66,9 +66,6 @@ try {
|
||||
};
|
||||
data = JSON.stringify(data);
|
||||
|
||||
console.log('test 0');
|
||||
|
||||
|
||||
const req = http.request(
|
||||
{
|
||||
host: 'api.github.com',
|
||||
@@ -82,7 +79,6 @@ try {
|
||||
}
|
||||
},
|
||||
res => {
|
||||
console.log('foooo!');
|
||||
let body = '';
|
||||
|
||||
res.on('data', data => {
|
||||
@@ -94,13 +90,9 @@ try {
|
||||
});
|
||||
});
|
||||
|
||||
console.log('test 1');
|
||||
req.write(data);
|
||||
console.log('test 2');
|
||||
req.end();
|
||||
|
||||
console.log('test 3');
|
||||
|
||||
} catch (error) {
|
||||
core.setFailed(error);
|
||||
}
|
||||
Reference in New Issue
Block a user