From 5daff8a5e3da420bcb30f49feeace9f03de7d978 Mon Sep 17 00:00:00 2001 From: Isaac Milarsky Date: Thu, 13 Jun 2024 09:46:25 -0500 Subject: [PATCH] parse org in python script Signed-off-by: Isaac Milarsky --- .github/workflows/update_data.yml | 2 +- scripts/refresh_metrics.py | 6 ++++++ update.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_data.yml b/.github/workflows/update_data.yml index 0c8b3463fe..8fc8cfe7aa 100644 --- a/.github/workflows/update_data.yml +++ b/.github/workflows/update_data.yml @@ -37,7 +37,7 @@ jobs: git config user.email 'actions@users.noreply.github.com' git add -A timestamp=$(date -u) - git commit -m "update data: ${timestamp}" || exit 0 + git commit -m "update ${{ matrix.orgs }} data: ${timestamp}" || exit 0 - name: Push to ${{ github.ref_name }} uses: CasperWA/push-protected@v2 with: diff --git a/scripts/refresh_metrics.py b/scripts/refresh_metrics.py index 9477821ca4..74cba09365 100644 --- a/scripts/refresh_metrics.py +++ b/scripts/refresh_metrics.py @@ -2,6 +2,7 @@ Script to run all metrics collection and update operations """ import os +import argparse from fetch_public_metrics import get_all_data, parse_repos_and_orgs_into_objects from fetch_public_metrics import parse_tracked_repos_file, read_previous_metric_data @@ -10,6 +11,11 @@ if __name__ == "__main__": os.umask(0) + parser = argparse.ArgumentParser(description='Metrics script to update data') + parser.add_argument('org', type=str, nargs='?', + help='The GitHub Org to update data for.') + args = parser.parse_args() + orgs_urls, repo_urls = parse_tracked_repos_file() all_orgs, all_repos = parse_repos_and_orgs_into_objects(orgs_urls, repo_urls) diff --git a/update.sh b/update.sh index 70f8843ce5..5c4d66f31e 100755 --- a/update.sh +++ b/update.sh @@ -1,4 +1,4 @@ #!/bin/bash pwd cd scripts -python3 refresh_metrics.py \ No newline at end of file +python3 refresh_metrics.py $1 \ No newline at end of file