diff --git a/dist/index.js b/dist/index.js index 6fbb3bb..cc49203 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9623,8 +9623,7 @@ async function validate(){ function getFiles() { return process.env.INPUT_FILES .split(' ') - .filter(file => !file.includes('.yml')) - .filter(file => !file.includes('.xml')) + .filter(isMarkdown) .filter(file => !invalidFiles.includes(file)) .filter(isNumericPath) } @@ -9718,6 +9717,10 @@ function isNumericPath(path) { return !isNaN(name) } +function isMarkdown(path){ + return path.includes('.md') +} + module.exports = validate /***/ }), diff --git a/src/test/integration.test.js b/src/test/integration.test.js index 7ae6458..f610267 100644 --- a/src/test/integration.test.js +++ b/src/test/integration.test.js @@ -86,4 +86,12 @@ describe('Test quiz validator', () =>{ const result = await validate() expect(result).toEqual(false) }) + + test('must return false when no files is markdown', async () => { + const files = ['test.js', 'test.yml', 'test.html', 'test.md', 'metadados.md', '.cspell.json'] + process.env.INPUT_FILES = files.concat(' ') + + const result = await validate() + expect(result).toEqual(false) + }) }) \ No newline at end of file diff --git a/src/validate.js b/src/validate.js index e17b0d2..9d329f0 100644 --- a/src/validate.js +++ b/src/validate.js @@ -61,8 +61,7 @@ async function validate(){ function getFiles() { return process.env.INPUT_FILES .split(' ') - .filter(file => !file.includes('.yml')) - .filter(file => !file.includes('.xml')) + .filter(isMarkdown) .filter(file => !invalidFiles.includes(file)) .filter(isNumericPath) } @@ -156,4 +155,8 @@ function isNumericPath(path) { return !isNaN(name) } +function isMarkdown(path){ + return path.includes('.md') +} + module.exports = validate \ No newline at end of file