Skip to content

Commit

Permalink
fix: isCommonModule function wasn't boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
jilgue committed Apr 5, 2022
1 parent 81fb214 commit bab4351
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23040,11 +23040,11 @@ exports.getDirectories = getDirectories;
const getDirectoriesToRun = (paths, workingDirectory, commonModules, excludeDirectories, log) => {
let ret = Array();
for (const path of paths) {
const isCommonModule = commonModules.filter(commonModule => {
const isCommonModule = !lodash_1.isEmpty(commonModules.filter(commonModule => {
const re = new RegExp('^' + commonModule);
return path.match(re);
});
if (isCommonModule) {
}));
if (isCommonModule === true) {
log.info('Common modules has been modified, searching for all componentes...');
const allComponents = lodash_1.difference(exports.getDirectories(workingDirectory), commonModules, excludeDirectories);
for (const component of allComponents) {
Expand Down
8 changes: 4 additions & 4 deletions src/getDirectories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs'
import path from 'path'
import { difference, compact, uniq } from 'lodash'
import { difference, compact, uniq, isEmpty } from 'lodash'
import { LogInterface } from './main'

export const getDirectories = (source: string): Array<string> =>
Expand All @@ -11,11 +11,11 @@ export const getDirectories = (source: string): Array<string> =>
export const getDirectoriesToRun = (paths: Array<string>, workingDirectory: string, commonModules: Array<string>, excludeDirectories: Array<string>, log: LogInterface): Array<any> => {
let ret = Array<string>()
for (const path of paths) {
const isCommonModule = commonModules.filter(commonModule => {
const isCommonModule = !isEmpty(commonModules.filter(commonModule => {
const re = new RegExp('^' + commonModule)
return path.match(re)
})
if (isCommonModule) {
}))
if (isCommonModule === true) {
log.info('Common modules has been modified, searching for all componentes...')
const allComponents = difference(getDirectories(workingDirectory), commonModules, excludeDirectories)

Expand Down
14 changes: 6 additions & 8 deletions src/script.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as core from '@actions/core'

import { main, LogInterface } from './main'

class Log implements LogInterface {
Expand All @@ -9,13 +7,13 @@ class Log implements LogInterface {

try {
main({
workingDirectory: '__tests__/tf_project/', //core.getInput('workingDirectory'),
baseRef: '6c96ba983bcbebcc84f0eac4bf9ca458e2dc46b9', //core.getInput('baseRef'),
headRef: '92d985710d915c1abec8ffefd80b94e0a520d8c5', //core.getInput('headRef')
excludeDirectories: ['__tests__/tf_project/010-second'],
commonModules: ['__tests__/tf_project/common-module'],
workingDirectory: '.', //core.getInput('workingDirectory'),
baseRef: '01157a1b666676882d6c1d584107c21346cb3642', //core.getInput('baseRef'),
headRef: '25e2e8cbc31e529d0ee831644e6444d9403238c9', //core.getInput('headRef')
excludeDirectories: ['.github','root_path','010-awm','999-legacy-projects','tools', 'docs'],
commonModules: ['000-module'],
workspace: undefined,
apply: core.getInput('apply') === "true"
apply: false
}, new Log())
} catch (error) {
console.error(error)
Expand Down

0 comments on commit bab4351

Please sign in to comment.