Add Comfy Registry download tracker (#127)
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
name: Track Comfy Registry metrics
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "17 7 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
collect:
|
||||
name: Collect download trend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Preserve collector
|
||||
run: cp tools/collect_registry_metrics.py /tmp/collect_registry_metrics.py
|
||||
|
||||
- name: Check out metrics branch
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch origin registry-metrics || true
|
||||
if git show-ref --verify --quiet refs/remotes/origin/registry-metrics; then
|
||||
git switch --track origin/registry-metrics
|
||||
else
|
||||
git switch --orphan registry-metrics
|
||||
git rm -rf . || true
|
||||
fi
|
||||
|
||||
- name: Collect registry metrics
|
||||
run: python /tmp/collect_registry_metrics.py --node koolook --output-dir metrics
|
||||
|
||||
- name: Commit metrics
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add metrics/comfy-registry-downloads.csv metrics/README.md
|
||||
if git diff --cached --quiet; then
|
||||
echo "No metrics changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "Update Comfy Registry metrics"
|
||||
git push origin registry-metrics
|
||||
Reference in New Issue
Block a user