diff --git a/.github/workflows/monitor-actions-usage.yml b/.github/workflows/monitor-actions-usage.yml new file mode 100644 index 0000000..f62bffd --- /dev/null +++ b/.github/workflows/monitor-actions-usage.yml @@ -0,0 +1,51 @@ +name: Monitor Actions Usage +on: + schedule: + - cron: '0 0 1 * *' # Monthly on 1st + workflow_dispatch: + +jobs: + report: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Get Actions Usage + run: | + echo "## GitHub Actions Usage Report" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Repository: ${{ github.repository }}" >> $GITHUB_STEP_SUMMARY + echo "Report Date: $(date)" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Get last 100 workflow runs + gh api "/repos/${{ github.repository }}/actions/runs?per_page=100" \ + --jq '.workflow_runs[] | select(.updated_at >= (now - 30*86400 | strftime("%Y-%m-%dT%H:%M:%SZ"))) | {name: .name, status: .conclusion, duration_ms: .run_duration_ms, created: .created_at}' \ + > /tmp/runs.json || true + + echo "### Last 30 Days Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Count total runs + TOTAL_RUNS=$(cat /tmp/runs.json | wc -l) + echo "- Total workflow runs: $TOTAL_RUNS" >> $GITHUB_STEP_SUMMARY + + # Calculate total duration (approximate minutes) + TOTAL_MS=$(cat /tmp/runs.json | grep -o '"duration_ms":[0-9]*' | grep -o '[0-9]*' | awk '{sum+=$1} END {print sum}') + TOTAL_MIN=$((TOTAL_MS / 60000)) + echo "- Total compute time: ~$TOTAL_MIN minutes" >> $GITHUB_STEP_SUMMARY + + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create artifact + run: | + mkdir -p reports + date > reports/report-$(date +%Y-%m).txt + echo "Usage report generated" >> reports/report-$(date +%Y-%m).txt + + - name: Upload Report + uses: actions/upload-artifact@v4 + with: + name: actions-usage-report + path: reports/ + retention-days: 90 diff --git a/.github/workflows/scheduled-claude-code-dependency-audit.yml b/.github/workflows/scheduled-claude-code-dependency-audit.yml index 6142266..d632218 100644 --- a/.github/workflows/scheduled-claude-code-dependency-audit.yml +++ b/.github/workflows/scheduled-claude-code-dependency-audit.yml @@ -2,8 +2,8 @@ name: Scheduled - Dependency Audit on: schedule: - # Run every 2 weeks (1st and 15th of each month) at 10 AM UTC - - cron: '0 10 1,15 * *' + # Run on the 1st of each month at 10 AM UTC + - cron: '0 10 1 * *' workflow_dispatch: concurrency: diff --git a/.github/workflows/scheduled-claude-code-quality.yml b/.github/workflows/scheduled-claude-code-quality.yml index 1afd88a..ef74789 100644 --- a/.github/workflows/scheduled-claude-code-quality.yml +++ b/.github/workflows/scheduled-claude-code-quality.yml @@ -2,8 +2,8 @@ name: Scheduled - Code Quality Review on: schedule: - # Run every Sunday at 8 AM UTC - - cron: '0 8 * * 0' + # Run on the 1st of each month at 8 AM UTC + - cron: '0 8 1 * *' workflow_dispatch: inputs: num_dirs: