Skip to content

Commit

Permalink
Using relative path to files in detectFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
sebryu committed Sep 25, 2023
1 parent d80c9b0 commit c2136a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit c2136a6

Please sign in to comment.