summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Morgan <[email protected]>2025-08-05 15:55:50 -0400
committerBryan Morgan <[email protected]>2025-08-05 15:55:50 -0400
commitd421fa9e64d44981bfaabf98deb3ff5e5fc5d0eb (patch)
tree1ba0975e73e0e9d3e63119cda5592795de784544
parent2778c7d851740631b4dbacf907b63db26a6e1816 (diff)
Testing basic velocity report action
-rw-r--r--.github/workflows/scripts/generate-report.sh23
-rw-r--r--.github/workflows/weekly-velocity-report.yml39
2 files changed, 62 insertions, 0 deletions
diff --git a/.github/workflows/scripts/generate-report.sh b/.github/workflows/scripts/generate-report.sh
new file mode 100644
index 00000000..04879117
--- /dev/null
+++ b/.github/workflows/scripts/generate-report.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# --- Configuration ---
+USERNAMES=("davideast" "hugomurillomtz" "jakemac53" "richieforeman" "shishu314" "shrutip90" "i14h" "hritan")
+
+# --- Date Calculation ---
+START_DATE=$(date -d "last Friday" +%Y-%m-%d)
+END_DATE=$(date -d "last Thursday" +%Y-%m-%d)
+DATE_RANGE="${START_DATE}..${END_DATE}"
+
+# --- Report Generation ---
+# Print a header row for the CSV
+echo "Date Range,Username,PRs Submitted,Issues Closed"
+
+# Loop through each user and generate a data row
+for USER in "${USERNAMES[@]}"; do
+ # Get metrics using the GitHub CLI
+ PRS_SUBMITTED=$(gh pr list --author "${USER}" --search "created:${DATE_RANGE}" --repo "${GITHUB_REPO}" --json number --jq 'length')
+ ISSUES_CLOSED=$(gh issue list --search 'closer:"${USER}" closed:${DATE_RANGE}' --repo "${GITHUB_REPO}" --json number --jq 'length')
+
+ # Print the data as a CSV row
+ echo "${START_DATE} to ${END_DATE},${USER},${PRS_SUBMITTED},${ISSUES_CLOSED}"
+done
diff --git a/.github/workflows/weekly-velocity-report.yml b/.github/workflows/weekly-velocity-report.yml
new file mode 100644
index 00000000..858c1128
--- /dev/null
+++ b/.github/workflows/weekly-velocity-report.yml
@@ -0,0 +1,39 @@
+# .github/workflows/weekly-velocity-report.yml
+
+name: Weekly Velocity Report
+
+on:
+ schedule:
+ #- cron: "0 13 * * 1" # Runs every Monday at 9:00 AM UTC
+ - cron: "*/5 * * * *" # Test by running every 5 minutes
+ workflow_dispatch:
+
+jobs:
+ generate_report:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Generate Weekly Report as CSV
+ id: report
+ env:
+ GH_TOKEN: ${{ secrets.GH_PAT }}
+ GITHUB_REPO: ${{ github.repository }}
+ run: |
+ chmod +x ./.github/workflows/scripts/generate-report.sh
+ REPORT_CSV=$(./.github/workflows/scripts/generate-report.sh)
+ echo "csv_data<<EOF" >> $GITHUB_OUTPUT
+ echo "$REPORT_CSV" >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
+
+ - name: Append data to Google Sheet
+ if: success()
+ uses: jroehl/[email protected]
+ with:
+ gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
+ spreadsheet_id: ${{ secrets.SPREADSHEET_ID }}
+ sheet_name: "Weekly Reports" # The name of the tab in your sheet
+ data: ${{ steps.report.outputs.csv_data }}
+ major_dimension: "ROWS"
+ value_input_option: "USER_ENTERED"