-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jack-mailslurp
committed
May 3, 2024
1 parent
60c50c7
commit e174626
Showing
4 changed files
with
560 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
import subprocess | ||
import re | ||
|
||
# Initialize an empty list to store folders with outdated dependencies | ||
error_array = [] | ||
|
||
# Read .githubactionsignore file | ||
with open('.githubactionsignore', 'r') as f: | ||
ignore_list = f.read().splitlines() | ||
|
||
# Iterate over the items in the root directory | ||
for item in os.listdir('.'): | ||
# Ignore files and directories in .githubactionsignore | ||
if item in ignore_list: | ||
continue | ||
|
||
# Ignore non-directory items | ||
if not os.path.isdir(item): | ||
continue | ||
|
||
# Split the folder name on _ or - | ||
parts = re.split('_|-', item) | ||
|
||
# Check if the first part starts with 'js' or 'javascript' | ||
if parts[0].lower().startswith(('js', 'javascript')): | ||
# Change into the directory | ||
os.chdir(item) | ||
|
||
# Run 'npm outdated' and capture the output | ||
result = subprocess.run(['npm', 'outdated'], capture_output=True, text=True) | ||
|
||
# If there are outdated dependencies, add the folder to the error array | ||
if result.stdout: | ||
error_array.append(item) | ||
|
||
# Change back to the root directory | ||
os.chdir('..') | ||
|
||
# If the error array is not empty, print the folders and exit with code 1 | ||
if error_array: | ||
print("The following folders have outdated dependencies:") | ||
for folder in error_array: | ||
print(folder) | ||
exit(1) | ||
else: | ||
print("All good") | ||
exit(0) |
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
Oops, something went wrong.