Skip to content

Commit 91d5222

Browse files
committed
update paths
1 parent 78ea4c9 commit 91d5222

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

.github/actions/find/src/pluginManager.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,39 +56,28 @@ export function clearCache() {
5656
export async function loadBuiltInPlugins() {
5757
core.info('Loading built-in plugins')
5858

59-
// - this is the path where actions appear when they're used in a workflow/repo
60-
console.log('__dirname: ' + __dirname)
6159
const pluginsPath = path.join(__dirname, '../../../scanner-plugins/')
62-
63-
console.log('path.join(__dirname, "../../../scanner-plugins/"): ' + pluginsPath)
64-
await loadPluginsFromPath({
65-
readPath: pluginsPath,
66-
importPath: pluginsPath,
67-
})
60+
await loadPluginsFromPath({ pluginsPath })
6861
}
6962

7063
// exported for mocking/testing. not for actual use
7164
export async function loadCustomPlugins() {
7265
core.info('Loading custom plugins')
7366

74-
console.log('current working directory: ' + process.cwd())
75-
const pluginsPath = process.cwd() + '/.github/scanner-plugins/'
76-
await loadPluginsFromPath({
77-
readPath: pluginsPath,
78-
importPath: pluginsPath,
79-
})
67+
const pluginsPath = path.join(process.cwd(), '/.github/scanner-plugins/')
68+
await loadPluginsFromPath({ pluginsPath })
8069
}
8170

8271
// exported for mocking/testing. not for actual use
83-
export async function loadPluginsFromPath({readPath, importPath}: {readPath: string; importPath: string}) {
72+
export async function loadPluginsFromPath({pluginsPath}: {pluginsPath: string}) {
8473
try {
85-
const res = fs.readdirSync(readPath)
74+
const res = fs.readdirSync(pluginsPath)
8675
for (const pluginFolder of res) {
87-
const pluginFolderPath = path.join(importPath, pluginFolder)
88-
console.log('plugin folder path: ' + pluginFolderPath)
76+
const pluginFolderPath = path.join(pluginsPath, pluginFolder)
77+
8978
if (fs.existsSync(pluginFolderPath) && fs.lstatSync(pluginFolderPath).isDirectory()) {
9079
core.info(`Found plugin: ${pluginFolder}`)
91-
plugins.push(await dynamicImport(path.join(importPath, pluginFolder, '/index.js')))
80+
plugins.push(await dynamicImport(path.join(pluginsPath, pluginFolder, '/index.js')))
9281
}
9382
}
9483
} catch (e) {

0 commit comments

Comments
 (0)