Refactor Usage Statistics Tracker to support multiple package types, removing the config input in favor of specific inputs for npm, GitHub, PyPI, Homebrew, PowerShell, Postman, and Go. Update action.yml, README, and examples to reflect new input structure and enhance documentation.

This commit is contained in:
Luke Hagar
2025-07-29 14:50:30 -05:00
parent ce4a2e80ee
commit cb1866631c
11 changed files with 303 additions and 307 deletions

View File

@@ -0,0 +1,59 @@
name: Usage Statistics with Input-Based Configuration
on:
schedule:
- cron: '0 0 * * *' # Daily at midnight
workflow_dispatch:
jobs:
update-stats:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Usage Statistics Tracker
uses: LukeHagar/usage-statistics@v1
with:
# NPM packages to track
npm-packages: 'lodash,axios,react,vue'
# GitHub repositories to track
github-repositories: 'microsoft/vscode,facebook/react,vercel/next.js'
# PyPI packages to track
pypi-packages: 'requests,numpy,pandas'
# Homebrew formulas to track
homebrew-formulas: 'git,node,postgresql'
# PowerShell modules to track
powershell-modules: 'PowerShellGet,PSReadLine'
# Go modules to track
go-modules: 'github.com/gin-gonic/gin,github.com/go-chi/chi'
# Output configuration
json-output-path: 'data/stats.json'
csv-output-path: 'data/stats.csv'
report-output-path: 'docs/usage-report.md'
# README integration
update-readme: 'true'
readme-path: 'README.md'
# API tokens
github-token: ${{ secrets.GITHUB_TOKEN }}
postman-api-key: ${{ secrets.POSTMAN_API_KEY }}
# Commit settings
commit-message: 'feat: update usage statistics with detailed report'
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add data/stats.json data/stats.csv docs/usage-report.md README.md
git commit -m "chore: update usage statistics [skip ci]" || echo "No changes to commit"
git push