feat: allow folder of problem matcher registration

Allows registering of new problem matchers by adding them to folder
pull/183/head
Nick Schonning 2020-08-15 14:09:05 -04:00
parent 59e61b8951
commit f87656b688
5 changed files with 14 additions and 12 deletions

11
dist/index.js vendored
View File

@ -4632,6 +4632,7 @@ const installer = __importStar(__webpack_require__(749));
const auth = __importStar(__webpack_require__(202)); const auth = __importStar(__webpack_require__(202));
const path = __importStar(__webpack_require__(622)); const path = __importStar(__webpack_require__(622));
const url_1 = __webpack_require__(835); const url_1 = __webpack_require__(835);
const fs = __importStar(__webpack_require__(747));
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
@ -4655,10 +4656,12 @@ function run() {
if (registryUrl) { if (registryUrl) {
auth.configAuthentication(registryUrl, alwaysAuth); auth.configAuthentication(registryUrl, alwaysAuth);
} }
const matchersPath = path.join(__dirname, '..', '.github'); // Iterate and register all problem matchers
console.log(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`); const matchersPath = path.join(__dirname, '..', 'matchers');
console.log(`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`); const matchers = fs.readdirSync(matchersPath);
console.log(`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`); matchers.forEach(matcher => {
console.log(`##[add-matcher]${path.join(matchersPath, matcher)}`);
});
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error.message);

View File

@ -3,6 +3,7 @@ import * as installer from './installer';
import * as auth from './authutil'; import * as auth from './authutil';
import * as path from 'path'; import * as path from 'path';
import {URL} from 'url'; import {URL} from 'url';
import * as fs from 'fs';
export async function run() { export async function run() {
try { try {
@ -30,14 +31,12 @@ export async function run() {
auth.configAuthentication(registryUrl, alwaysAuth); auth.configAuthentication(registryUrl, alwaysAuth);
} }
const matchersPath = path.join(__dirname, '..', '.github'); // Iterate and register all problem matchers
console.log(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`); const matchersPath = path.join(__dirname, '..', 'matchers');
console.log( const matchers = fs.readdirSync(matchersPath);
`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}` matchers.forEach(matcher => {
); console.log(`##[add-matcher]${path.join(matchersPath, matcher)}`);
console.log( });
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
);
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
} }