-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add warnings and dependency outdated check
- Loading branch information
1 parent
635b9fa
commit f164e99
Showing
5 changed files
with
292 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.github/workflows/new-app-review/validators/dependencies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const { exec } = require('child_process'); | ||
const util = require('util'); | ||
|
||
const execPromise = util.promisify(exec); | ||
|
||
module.exports = { | ||
validate: async ({ github, context, core }, newAppDir, files) => { | ||
let warning = ''; | ||
let result = true; | ||
let message = 'Dependency check finished'; | ||
try { | ||
const { stdout, stderr } = await execPromise(`cd ${newAppDir} && npm outdated --json`); | ||
|
||
if (stderr) { | ||
result = false; | ||
message = 'Unable to check for outdated dependencies'; | ||
console.error(`stderr: ${stderr}`); | ||
} | ||
|
||
console.log(stdout); | ||
const outdatedDependencies = JSON.parse(stdout); | ||
|
||
if (Object.keys(outdatedDependencies).length > 0) { | ||
warning += 'The following dependencies are outdated:\n'; | ||
warning += outdatedDependencies; | ||
console.log(warning); | ||
} | ||
} catch (error) { | ||
message = 'Failed to check for outdated dependencies'; | ||
console.error(`exec error: ${error}`); | ||
result = false; | ||
} | ||
|
||
return { | ||
result, | ||
message, | ||
warning, | ||
}; | ||
}, | ||
}; |
Oops, something went wrong.