mirror of
https://github.com/tiennm99/is-a-good-dev.git
synced 2026-10-13 04:15:08 +00:00
prettier
This commit is contained in:
1 parent
0992ac4f68
commit
8808f1b60d
1 file changed
+9
-6
+9
-6
@@ -3,19 +3,19 @@ const fs = require('fs');
|
||||
const core = require('@actions/core');
|
||||
|
||||
function getFiles(path) {
|
||||
//get all files in path, returns arr
|
||||
// Get all files in path: returns array
|
||||
const allFiles = fs.readdirSync(path);
|
||||
|
||||
return allFiles
|
||||
}
|
||||
|
||||
function getFileExtension(filename) {
|
||||
//get file ext
|
||||
// Get file extension
|
||||
return (/[.]/.exec(filename)) ? /[^.]+$/.exec(filename) : undefined;
|
||||
}
|
||||
|
||||
function stripExt(filename) {
|
||||
//remove file ext
|
||||
// Remove file extension
|
||||
return filename.substr(0, filename.lastIndexOf('.'))
|
||||
}
|
||||
|
||||
@@ -34,17 +34,20 @@ function checkIfValidFQDN(str) {
|
||||
}
|
||||
|
||||
function checkInvalidDomain(str) {
|
||||
//check invalid domains
|
||||
// Check invalid domains
|
||||
if (invalidDomains.includes(str)) {
|
||||
core.setOutput("recordInfo", "This subdomain has been blocked for register by the is-a-good.dev team.")
|
||||
core.setOutput("recordInfo", "This subdomain has been blocked.")
|
||||
return true;
|
||||
}
|
||||
//check reserved domains
|
||||
|
||||
// Check reserved domains
|
||||
const files = getFiles("./reserved/").map(file => stripExt(file));
|
||||
|
||||
if (files.includes(str)) {
|
||||
core.setOutput("recordInfo", "This subdomain has been reserved by the is-a-good.dev team.")
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user