Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/scripts/check_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import yaml
import requests
import os
import sys

print("Current Directory:", os.getcwd())


def get_latest_docker_image_version(repo_name):
url = f"https://registry.hub.docker.com/v2/repositories/huskyci/{repo_name}/tags"
response = requests.get(url)
data = response.json()

# Assuming the first result is the latest
latest_version = data['results'][0]['name']
return latest_version


def main():
dependencies_are_outdated = False

with open('api/config.yaml', 'r') as f:
config = yaml.safe_load(f)

for tool, tool_info in config.items():
current_version = tool_info['imageTag']
latest_version = get_latest_docker_image_version(
tool_info['image'].split('/')[-1])

if current_version != latest_version:
print(
f"::error::{tool} is outdated. Current: {current_version}, Latest: {latest_version}")
dependencies_are_outdated = True
else:
print(f"{tool} is up-to-date with version {current_version}.")

if dependencies_are_outdated:
sys.exit(1)


if __name__ == "__main__":
main()
27 changes: 27 additions & 0 deletions .github/workflows/tools_version_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tools Version Checker

on:
schedule:
- cron: '0 0 * * *' # This will run every day at midnight
workflow_dispatch:

jobs:
check-versions:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1

- name: Set up Python
uses: actions/setup-python@v4.7.1
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml requests

- name: Check tool versions
run: python .github/scripts/check_versions.py