mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 22:42:54 +00:00
feat: add check for contributors
This commit is contained in:
22
src/cli.ts
22
src/cli.ts
@@ -13,6 +13,7 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
import {execSync} from 'child_process';
|
||||||
import * as commander from 'commander';
|
import * as commander from 'commander';
|
||||||
import {copyFileSync, existsSync, readFileSync, writeFileSync} from 'fs';
|
import {copyFileSync, existsSync, readFileSync, writeFileSync} from 'fs';
|
||||||
import {resolve, sep} from 'path';
|
import {resolve, sep} from 'path';
|
||||||
@@ -168,6 +169,27 @@ Object.keys(SCRIPTS).forEach((scriptName) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const execBuffer = execSync('git log --format=\'%aN\' | sort -u');
|
||||||
|
for (let author of execBuffer.toString().split('\n')) {
|
||||||
|
author = author.trim();
|
||||||
|
|
||||||
|
if (author === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let authorIsAttributed = false;
|
||||||
|
|
||||||
|
authorIsAttributed = authorIsAttributed
|
||||||
|
|| (typeof packageJson.author === 'string' && packageJson.author.indexOf(author) >= 0)
|
||||||
|
|| (Array.isArray(packageJson.contributors) && packageJson.contributors.find((contributor: string) => {
|
||||||
|
return contributor.indexOf(author) >= 0;
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (!authorIsAttributed) {
|
||||||
|
consoleInfo(`'${author}' should be attributed as author or contributor.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check CI config if it exists
|
// check CI config if it exists
|
||||||
const pathToCiConfig = resolve(path, '.gitlab-ci.yml');
|
const pathToCiConfig = resolve(path, '.gitlab-ci.yml');
|
||||||
if (existsSync(pathToCiConfig)) {
|
if (existsSync(pathToCiConfig)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user