From 76c80d225c60e4a3d646c4314eb4909d4a2af907 Mon Sep 17 00:00:00 2001 From: bjoernbethge Date: Thu, 15 Jan 2026 13:23:57 +0100 Subject: [PATCH 1/2] chore(workflows): optimize scheduled workflow frequency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce scheduled AI-powered workflows from weekly/biweekly to monthly to optimize GitHub Actions usage and costs. Changes: - Code Quality Review: weekly (Sun) → monthly (1st of month) Saves ~135 minutes/month (~75% reduction) - Dependency Audit: biweekly (1st & 15th) → monthly (1st only) Saves ~45 minutes/month (~50% reduction) Total savings: ~180 minutes/month (~67% reduction in scheduled runs) Both workflows retain workflow_dispatch for manual triggering when needed. Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/scheduled-claude-code-dependency-audit.yml | 4 ++-- .github/workflows/scheduled-claude-code-quality.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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: From 323ec18daa60bc9d3e9e252e24a416679e0370eb Mon Sep 17 00:00:00 2001 From: bjoernbethge Date: Thu, 15 Jan 2026 14:01:35 +0100 Subject: [PATCH 2/2] Add monthly GitHub Actions usage monitoring workflow - Track workflow runs and compute time over last 30 days - Generate monthly reports via scheduled workflow - Store reports as artifacts with 90-day retention - Enable manual triggering via workflow_dispatch Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/monitor-actions-usage.yml | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/monitor-actions-usage.yml 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