Skip to content

Commit cacd167

Browse files
authored
ci: reduce office-hours reminder spam by posting only on most recent PR per user (hiero-ledger#1150)
Signed-off-by: Tianyang Ren <[email protected]>
1 parent 3241d95 commit cacd167

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.github/workflows/bot-office-hours.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ jobs:
3737
echo "Meeting week detected. Proceeding to notify open PRs."
3838
3939
REPO="${{ github.repository }}"
40-
PR_LIST=$(gh pr list --repo $REPO --state open --json number --jq '.[].number')
40+
PR_DATA=$(gh pr list --repo $REPO --state open --json number,author,createdAt)
4141
42-
if [ -z "$PR_LIST" ]; then
42+
if [ -z "$PR_DATA" ] || [ "$PR_DATA" = "[]" ]; then
4343
echo "No open PRs found."
4444
exit 0
4545
fi
@@ -59,8 +59,8 @@ jobs:
5959
EOF
6060
)
6161
62-
for PR_NUM in $PR_LIST; do
63-
echo "Processing PR #$PR_NUM"
62+
echo "$PR_DATA" | jq -r 'group_by(.author.login) | .[] | sort_by(.createdAt) | reverse | .[0] | .number' | while read PR_NUM; do
63+
echo "Processing most recent PR #$PR_NUM for user"
6464
6565
ALREADY_COMMENTED=$(gh pr view $PR_NUM --repo $REPO --json comments --jq '.comments[].body' | grep -F "Office Hour Bot" || true)
6666

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
5454
- Added advanced issue template for contributors `.github/ISSUE_TEMPLATE/06_advanced_issue.yml`.
5555

5656
### Changed
57+
- Reduce office-hours reminder spam by posting only on each user's most recent open PR, grouping by author and sorting by creation time (#1121)
5758
- Pylint cleanup for token_airdrop_transaction_cancel.py (#1081) [@tiya-15](https://github.com/tiya-15)
5859
- Move `account_allowance_delete_transaction_hbar.py` from `examples/` to `examples/account/` for better organization (#1003)
5960
- Improved consistency of transaction examples (#1120)

0 commit comments

Comments
 (0)