GitHub Action for velocity reporting purposes (#5607)
This commit is contained in:
parent
d421fa9e64
commit
c194a6ac3b
|
@ -1,8 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# --- Configuration ---
|
|
||||||
USERNAMES=("davideast" "hugomurillomtz" "jakemac53" "richieforeman" "shishu314" "shrutip90" "i14h" "hritan")
|
|
||||||
|
|
||||||
# --- Date Calculation ---
|
# --- Date Calculation ---
|
||||||
START_DATE=$(date -d "last Friday" +%Y-%m-%d)
|
START_DATE=$(date -d "last Friday" +%Y-%m-%d)
|
||||||
END_DATE=$(date -d "last Thursday" +%Y-%m-%d)
|
END_DATE=$(date -d "last Thursday" +%Y-%m-%d)
|
||||||
|
@ -12,8 +9,11 @@ DATE_RANGE="${START_DATE}..${END_DATE}"
|
||||||
# Print a header row for the CSV
|
# Print a header row for the CSV
|
||||||
echo "Date Range,Username,PRs Submitted,Issues Closed"
|
echo "Date Range,Username,PRs Submitted,Issues Closed"
|
||||||
|
|
||||||
|
# Get a list of all repository contributors, filter out bots, and extract the login name
|
||||||
|
USERNAMES=$(gh repo contributors --repo "${GITHUB_REPO}" --json "login" --jq '.[] | select(.login | contains("[bot]") | not) | .login')
|
||||||
|
|
||||||
# Loop through each user and generate a data row
|
# Loop through each user and generate a data row
|
||||||
for USER in "${USERNAMES[@]}"; do
|
for USER in $USERNAMES; do
|
||||||
# Get metrics using the GitHub CLI
|
# Get metrics using the GitHub CLI
|
||||||
PRS_SUBMITTED=$(gh pr list --author "${USER}" --search "created:${DATE_RANGE}" --repo "${GITHUB_REPO}" --json number --jq 'length')
|
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')
|
ISSUES_CLOSED=$(gh issue list --search 'closer:"${USER}" closed:${DATE_RANGE}' --repo "${GITHUB_REPO}" --json number --jq 'length')
|
||||||
|
|
|
@ -5,7 +5,7 @@ name: Weekly Velocity Report
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
#- cron: "0 13 * * 1" # Runs every Monday at 9:00 AM UTC
|
#- cron: "0 13 * * 1" # Runs every Monday at 9:00 AM UTC
|
||||||
- cron: "*/5 * * * *" # Test by running every 5 minutes
|
- cron: '*/5 * * * *' # Test by running every 5 minutes
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -29,11 +29,11 @@ jobs:
|
||||||
|
|
||||||
- name: Append data to Google Sheet
|
- name: Append data to Google Sheet
|
||||||
if: success()
|
if: success()
|
||||||
uses: jroehl/gcp-google-sheets-action@v2.0.0
|
uses: jroehl/gsheet.action@v2.0.0
|
||||||
with:
|
with:
|
||||||
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
|
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
|
||||||
spreadsheet_id: ${{ secrets.SPREADSHEET_ID }}
|
spreadsheet_id: ${{ secrets.SPREADSHEET_ID }}
|
||||||
sheet_name: "Weekly Reports" # The name of the tab in your sheet
|
sheet_name: 'Weekly Reports' # The name of the tab in your sheet
|
||||||
data: ${{ steps.report.outputs.csv_data }}
|
data: ${{ steps.report.outputs.csv_data }}
|
||||||
major_dimension: "ROWS"
|
major_dimension: 'ROWS'
|
||||||
value_input_option: "USER_ENTERED"
|
value_input_option: 'USER_ENTERED'
|
||||||
|
|
Loading…
Reference in New Issue