Skip to content

Commit

Permalink
chore: add workflow to find the python dependencies in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
salman2013 committed Mar 28, 2024
1 parent da22d2c commit 3bd672f
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/check_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,39 @@ jobs:
run: |
source .venv/bin/activate # Activate the virtual environment
python - << EOF
import subprocess
import re
import subprocess
import re
# Define the first-party and second-party organizations
FIRST_PARTY_ORGS = ["openedx"]
SECOND_PARTY_ORGS = [
"edx", "edx-unsupported", "edx-solutions",
"mitodl",
"overhangio",
"open-craft", "eduNEXT", "raccoongang",
]
# Define the first-party and second-party organizations
FIRST_PARTY_ORGS = ["openedx"]
SECOND_PARTY_ORGS = [
"edx", "edx-unsupported", "edx-solutions",
"mitodl",
"overhangio",
"open-craft", "eduNEXT", "raccoongang",
]
# Get the output of 'pip list' command
pip_list_output = subprocess.run(['pip', 'list'], capture_output=True, text=True).stdout
# Get the output of 'pip list' command
pip_list_output = subprocess.run(['pip', 'list'], capture_output=True, text=True).stdout
# Find source repositories for each installed package
first_party_repos = []
second_party_repos = []
for line in pip_list_output.split('\n'):
match = re.match(r'([\w-]+) \(([\d.]+)\)', line)
if match:
package_name = match.group(1)
# Assume the source repository URL can be extracted from the package name (modify this as per your project's conventions)
# Here, we just append 'https://github.com/{package_name}' for demonstration purposes
repo_url = f'https://github.com/{package_name}'
if any(org in repo_url for org in FIRST_PARTY_ORGS):
first_party_repos.append(repo_url)
elif any(org in repo_url for org in SECOND_PARTY_ORGS):
second_party_repos.append(repo_url)
# Find source repositories for each installed package
first_party_repos = []
second_party_repos = []
for line in pip_list_output.split('\n'):
match = re.match(r'([\w-]+) \(([\d.]+)\)', line)
if match:
package_name = match.group(1)
# Assume the source repository URL can be extracted from the package name (modify this as per your project's conventions)
# Here, we just append 'https://github.com/{package_name}' for demonstration purposes
repo_url = f'https://github.com/{package_name}'
if any(org in repo_url for org in FIRST_PARTY_ORGS):
first_party_repos.append(repo_url)
elif any(org in repo_url for org in SECOND_PARTY_ORGS):
second_party_repos.append(repo_url)
print("::set-output name=first_party_repos::{}".format(','.join(first_party_repos)))
print("::set-output name=second_party_repos::{}".format(','.join(second_party_repos)))
EOF
print("::set-output name=first_party_repos::{}".format(','.join(first_party_repos)))
print("::set-output name=second_party_repos::{}".format(','.join(second_party_repos)))
EOF
- name: Display Source Repos
run: |
Expand Down

0 comments on commit 3bd672f

Please sign in to comment.