Update traffic statistics

This commit is contained in:
github-actions[bot]
2026-01-02 07:22:08 +00:00
commit 2b8782a8d4
120 changed files with 17233 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
name: Update Clone Count Badge
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
workflow_dispatch: # Allows manual trigger
jobs:
update-badge:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to push to the branch
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch Traffic Stats and Save JSON
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TRAFFIC_TOKEN }}
script: |
try {
const { owner, repo } = context.repo;
// 1. Fetch Clones
const clones = await github.rest.repos.getClones({
owner,
repo,
});
// 2. Fetch Views (Visitors)
const views = await github.rest.repos.getViews({
owner,
repo,
});
const fs = require('fs');
const data = {
clones: {
count: clones.data.count,
uniques: clones.data.uniques,
},
views: {
count: views.data.count,
uniques: views.data.uniques,
},
timestamp: new Date().toISOString()
};
console.log('Stats fetched:', JSON.stringify(data));
// Write to a generic stats file
fs.writeFileSync('traffic_stats.json', JSON.stringify(data, null, 2));
// Maintain the old file for backward compatibility if needed, or just switch everything
fs.writeFileSync('git_clones.json', JSON.stringify(data.clones, null, 2));
} catch (error) {
console.error('Error fetching stats:', error);
process.exit(1);
}
- name: Push to Badges Branch
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Stash the files
mv traffic_stats.json /tmp/traffic_stats.json
mv git_clones.json /tmp/git_clones.json
# Fetch the badges branch or create it
git fetch origin badges:badges || true
git checkout badges || git checkout --orphan badges
# Restore the files
mv /tmp/traffic_stats.json traffic_stats.json
mv /tmp/git_clones.json git_clones.json
# Commit and push
git add traffic_stats.json git_clones.json
git diff --quiet && git diff --staged --quiet || (git commit -m "Update traffic statistics" && git push origin badges)
+20
View File
@@ -0,0 +1,20 @@
name: Publish to Comfy registry
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "pyproject.toml"
jobs:
publish-node:
name: Publish Custom Node to registry
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Publish Custom Node
uses: Comfy-Org/publish-node-action@main
with:
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} ## Add your own personal access token to your Github Repository secrets and reference it here.