Skip to content

Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

Rust

chore: Update github_last_night.sh (#562)

Graham King7f3b2fe9fffa
diff --git a/scripts/community_gardener/github_last_night.sh b/scripts/community_gardener/github_last_night.sh
index 3a75069ad..777fef482 100755
--- a/scripts/community_gardener/github_last_night.sh
+++ b/scripts/community_gardener/github_last_night.sh
@@ -26,14 +26,45 @@ fi
repo="$(gh repo view --json nameWithOwner -q .nameWithOwner)"
since="$(date -u -d "$hours hours ago" +%Y-%m-%dT%H:%M:%SZ)"
+# Keep a snapshot of currently open issues and non-draft PRs so activity on
+# items that have since been closed or merged, and activity on drafts, is not
+# reported.
+open_items="$(mktemp)"
+trap 'rm -f "$open_items"' EXIT
+gh api --paginate -X GET "repos/$repo/issues" \
+ -f state=open -f sort=updated -f direction=asc -f per_page=100 |
+ jq -s --slurpfile prs <(
+ gh api --paginate -X GET "repos/$repo/pulls" \
+ -f state=open -f per_page=100 |
+ jq -s '[add[] | select(.draft | not) | .issue_url]'
+ ) '
+ add
+ | map(select(.pull_request == null or (.url as $url | $prs[0] | index($url))))
+ ' > "$open_items"
+
+report_comments() {
+ local endpoint="$1" kind="$2" url_field="$3"
+ gh api --paginate -X GET "repos/$repo/$endpoint" \
+ -f since="$since" -f per_page=100 |
+ jq -r --arg since "$since" --arg kind "$kind" --arg url_field "$url_field" \
+ --slurpfile open "$open_items" '
+ .[]
+ | . as $comment
+ | select(any($open[0][];
+ .url == $comment[$url_field] or .pull_request.url == $comment[$url_field]))
+ | select(.created_at >= $since)
+ | select(.user.login | endswith("[bot]") | not)
+ | [.created_at, $kind, .user.login, .html_url,
+ (.body | split("\n")[0] | gsub("\t"; " "))]
+ | @tsv '
+}
+
printf 'Overnight activity on %s. Last %s hours.\n\n' "$repo" "$hours"
{
printf 'WHEN\tKIND\tACTOR\tURL\tTEXT\n'
# Newly created Issues and PRs
- gh api --paginate -X GET "repos/$repo/issues" \
- -f state=all -f since="$since" -f sort=updated -f direction=asc -f per_page=100 |
jq -r --arg since "$since" '
.[]
| select(.created_at >= $since)
@@ -41,27 +72,11 @@ printf 'Overnight activity on %s. Last %s hours.\n\n' "$repo" "$hours"
| [.created_at,
(if .pull_request then "NEW PR" else "NEW ISSUE" end),
.user.login, .html_url, .title]
- | @tsv '
+ | @tsv ' "$open_items"
# New regular comments on Issues and PR conversations
- gh api --paginate -X GET "repos/$repo/issues/comments" \
- -f since="$since" -f per_page=100 |
- jq -r --arg since "$since" '
- .[]
- | select(.created_at >= $since)
- | select(.user.login | endswith("[bot]") | not)
- | [.created_at, "ISSUE/PR COMMENT", .user.login, .html_url,
- (.body | split("\n")[0] | gsub("\t"; " "))]
- | @tsv '
+ report_comments issues/comments 'ISSUE/PR COMMENT' issue_url
# New inline PR review comments
- gh api --paginate -X GET "repos/$repo/pulls/comments" \
- -f since="$since" -f per_page=100 |
- jq -r --arg since "$since" '
- .[]
- | select(.created_at >= $since)
- | select(.user.login | endswith("[bot]") | not)
- | [.created_at, "PR REVIEW COMMENT", .user.login, .html_url,
- (.body | split("\n")[0] | gsub("\t"; " "))]
- | @tsv '
+ report_comments pulls/comments 'PR REVIEW COMMENT' pull_request_url
} | column -ts $'\t'