mirror of
https://github.com/AmazonAppDev/devices-agent-skills.git
synced 2026-09-14 19:34:35 +08:00
69 lines
2.4 KiB
YAML
69 lines
2.4 KiB
YAML
name: Weekly Org Triage Summary
|
|
on:
|
|
schedule:
|
|
- cron: '0 9 * * 1' # Every Monday at 9am UTC (10am BST)
|
|
workflow_dispatch: # Manual trigger from Actions tab
|
|
|
|
jobs:
|
|
org-weekly-summary:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Scan all AmazonAppDev repos
|
|
run: |
|
|
ORG="AmazonAppDev"
|
|
TOTAL_ISSUES=0
|
|
TOTAL_PRS=0
|
|
BODY=""
|
|
|
|
REPOS=$(gh repo list "$ORG" --public --no-archived --json name --limit 100 -q '.[].name')
|
|
|
|
for REPO in $REPOS; do
|
|
ISSUES=$(gh issue list --repo "$ORG/$REPO" --state open --json number,title,url --limit 50 2>/dev/null || echo "[]")
|
|
PRS=$(gh pr list --repo "$ORG/$REPO" --state open --json number,title,url --limit 50 2>/dev/null || echo "[]")
|
|
|
|
ISSUE_COUNT=$(echo "$ISSUES" | jq length)
|
|
PR_COUNT=$(echo "$PRS" | jq length)
|
|
|
|
if [ "$ISSUE_COUNT" -gt 0 ] || [ "$PR_COUNT" -gt 0 ]; then
|
|
BODY+="--- ${REPO} ---"$'\n'
|
|
|
|
if [ "$ISSUE_COUNT" -gt 0 ]; then
|
|
BODY+="Issues (${ISSUE_COUNT}):"$'\n'
|
|
while IFS= read -r line; do
|
|
BODY+=" ${line}"$'\n'
|
|
done < <(echo "$ISSUES" | jq -r '.[] | "#\(.number) \(.title) - \(.url)"' | head -10)
|
|
TOTAL_ISSUES=$((TOTAL_ISSUES + ISSUE_COUNT))
|
|
fi
|
|
|
|
if [ "$PR_COUNT" -gt 0 ]; then
|
|
BODY+="PRs (${PR_COUNT}):"$'\n'
|
|
while IFS= read -r line; do
|
|
BODY+=" ${line}"$'\n'
|
|
done < <(echo "$PRS" | jq -r '.[] | "#\(.number) \(.title) - \(.url)"' | head -10)
|
|
TOTAL_PRS=$((TOTAL_PRS + PR_COUNT))
|
|
fi
|
|
|
|
BODY+=$'\n'
|
|
fi
|
|
done
|
|
|
|
if [ "$TOTAL_ISSUES" -eq 0 ] && [ "$TOTAL_PRS" -eq 0 ]; then
|
|
BODY="No open issues or PRs across the org!"
|
|
fi
|
|
|
|
TITLE="Weekly Triage: ${TOTAL_ISSUES} open issues, ${TOTAL_PRS} open PRs across ${ORG}"
|
|
|
|
PAYLOAD=$(jq -n \
|
|
--arg repo "$ORG" \
|
|
--arg event "Weekly Org Summary" \
|
|
--arg title "$TITLE" \
|
|
--arg url "$BODY" \
|
|
--arg user "https://github.com/$ORG" \
|
|
'{repo: $repo, event: $event, title: $title, url: $url, user: $user}')
|
|
|
|
curl -X POST "${{ secrets.SLACK_WEBHOOK_URL }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$PAYLOAD"
|