()
| 21 | const ROOT = resolve(process.cwd()); |
| 22 | |
| 23 | async function main(): Promise<void> { |
| 24 | if (process.argv.includes("--list-rules")) { |
| 25 | printRuleCatalog(META_RULES); |
| 26 | |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | const verifyMode = process.argv.includes("--verify"); |
| 31 | const ctx = buildContext(ROOT); |
| 32 | const syncViolations = runMetaRules(META_RULES, ctx); |
| 33 | |
| 34 | if (verifyMode) { |
| 35 | console.log("[lint:meta] Verifying action SHAs against github.com…"); |
| 36 | } |
| 37 | |
| 38 | const violations = [ |
| 39 | ...syncViolations, |
| 40 | ...(verifyMode ? await runMetaRulesAsync(META_RULES, ctx) : []) |
| 41 | ]; |
| 42 | |
| 43 | if (violations.length === 0) { |
| 44 | console.log( |
| 45 | verifyMode |
| 46 | ? "[lint:meta] No violations. All action SHAs resolve." |
| 47 | : "[lint:meta] No violations." |
| 48 | ); |
| 49 | |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | console.error(`[lint:meta] ${String(violations.length)} violation(s):\n`); |
| 54 | |
| 55 | for (const v of violations) { |
| 56 | console.error(` ${v.file}`); |
| 57 | console.error(` ${v.rule}: ${v.message}\n`); |
| 58 | } |
| 59 | |
| 60 | process.exit(1); |
| 61 | } |
| 62 | |
| 63 | if ( |
| 64 | process.argv[1] !== undefined && |
no test coverage detected