diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 4346e05919a2..c33b58edddd7 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -243,10 +243,14 @@ function detectReactComponent(code) { return isReactComponent; }; +function relativePath(filename) { + return `../../../../${filename}`; +} + function detectFunction(changedFiles) { console.log('detectFunction', changedFiles); const filteredFiles = _.filter((changedFiles), ({ filename }) => filename.endsWith('.js') || filename.endsWith('.jsx') || filename.endsWith('.ts') || filename.endsWith('.tsx')); - return _.some(filteredFiles, ({ filename }) => detectReactComponent(fs.readFileSync(filename, 'utf-8'))); + return _.some(filteredFiles, ({ filename }) => detectReactComponent(fs.readFileSync(relativePath(filename), 'utf-8'))); } module.exports = { diff --git a/.github/actions/javascript/authorChecklist/newComponentCategory.js b/.github/actions/javascript/authorChecklist/newComponentCategory.js index fd4417a4f5a2..58aef738e37e 100644 --- a/.github/actions/javascript/authorChecklist/newComponentCategory.js +++ b/.github/actions/javascript/authorChecklist/newComponentCategory.js @@ -43,10 +43,14 @@ function detectReactComponent(code) { return isReactComponent; }; +function relativePath(filename) { + return `../../../../${filename}`; +} + function detectFunction(changedFiles) { console.log('detectFunction', changedFiles); const filteredFiles = _.filter((changedFiles), ({ filename }) => filename.endsWith('.js') || filename.endsWith('.jsx') || filename.endsWith('.ts') || filename.endsWith('.tsx')); - return _.some(filteredFiles, ({ filename }) => detectReactComponent(fs.readFileSync(filename, 'utf-8'))); + return _.some(filteredFiles, ({ filename }) => detectReactComponent(fs.readFileSync(relativePath(filename), 'utf-8'))); } module.exports = {