mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 04:22:50 +00:00
@@ -483,13 +483,28 @@ export function checkContributors(path: PathLike, packageJson: PackageJSON): voi
|
|||||||
* @param path Path to CI config
|
* @param path Path to CI config
|
||||||
*/
|
*/
|
||||||
export function checkCIConfig(rules: Rules, path: string): void {
|
export function checkCIConfig(rules: Rules, path: string): void {
|
||||||
// check CI config if it exists
|
|
||||||
const pathToCiConfig = resolve(path, '.gitlab-ci.yml');
|
const pathToCiConfig = resolve(path, '.gitlab-ci.yml');
|
||||||
|
|
||||||
|
// check CI config if it exists
|
||||||
if (existsSync(pathToCiConfig)) {
|
if (existsSync(pathToCiConfig)) {
|
||||||
// read CI config
|
// read CI config
|
||||||
const buffer = readFileSync(pathToCiConfig);
|
const content = readFileSync(pathToCiConfig)
|
||||||
|
.toString();
|
||||||
|
|
||||||
|
let ciConfigWithoutTemplates = '';
|
||||||
|
|
||||||
|
for (const line of content.split('\n')) {
|
||||||
|
const match = line
|
||||||
|
.trim()
|
||||||
|
.match(/^<</);
|
||||||
|
|
||||||
|
if (match === null) {
|
||||||
|
ciConfigWithoutTemplates += `${line}\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ciConfig = parse(buffer.toString());
|
const ciConfig = parse(ciConfigWithoutTemplates);
|
||||||
|
|
||||||
// check entries
|
// check entries
|
||||||
for (const entry in rules.ciConfig) {
|
for (const entry in rules.ciConfig) {
|
||||||
|
|||||||
Reference in New Issue
Block a user