Skip to content

Commit 4a3c215

Browse files
committed
feat: exclude maintainers and commitres from office hour notifications
Signed-off-by: exploreriii <[email protected]>
1 parent 4f33085 commit 4a3c215

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: PythonBot - Office Hour Reminder
33
on:
44
# push:
55
schedule:
6-
- cron: '0 10 * * 3'
6+
- cron: "0 10 * * 3"
77
workflow_dispatch:
88

99
permissions:
@@ -15,18 +15,24 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Harden the runner
18-
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76
18+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 #2.14.0
1919
with:
2020
egress-policy: audit
2121

2222
- name: Check Schedule and Notify
2323
env:
2424
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2525
run: |
26+
set -euo pipefail
2627
ANCHOR_DATE="2025-12-03"
2728
MEETING_LINK="https://zoom-lfx.platform.linuxfoundation.org/meeting/99912667426?password=5b584a0e-1ed7-49d3-b2fc-dc5ddc888338"
2829
CALENDAR_LINK="https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week"
2930
31+
EXCLUDED_AUTHORS=(
32+
"hiero-sdk-python-maintainers"
33+
"hiero-sdk-python-committers"
34+
)
35+
3036
IS_MEETING_WEEK=$(python3 -c "from datetime import date; import os; d1=date.fromisoformat('$ANCHOR_DATE'); d2=date.today(); print('true' if (d2-d1).days % 14 == 0 else 'false')")
3137
3238
if [ "$IS_MEETING_WEEK" = "false" ]; then
@@ -59,9 +65,29 @@ jobs:
5965
EOF
6066
)
6167
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"
64-
68+
echo "$PR_DATA" |
69+
jq -r '
70+
group_by(.author.login)
71+
| .[]
72+
| sort_by(.createdAt)
73+
| reverse
74+
| .[0]
75+
| "\(.number) \(.author.login)"
76+
' |
77+
while read PR_NUM AUTHOR; do
78+
SKIP=false
79+
for EXCLUDED in "${EXCLUDED_AUTHORS[@]}"; do
80+
if [ "$AUTHOR" = "$EXCLUDED" ]; then
81+
SKIP=true
82+
break
83+
fi
84+
done
85+
86+
if [ "$SKIP" = "true" ]; then
87+
echo "Skipping PR #$PR_NUM by excluded author @$AUTHOR"
88+
continue
89+
fi
90+
6591
ALREADY_COMMENTED=$(gh pr view $PR_NUM --repo $REPO --json comments --jq '.comments[].body' | grep -F "Office Hour Bot" || true)
6692
6793
if [ -z "$ALREADY_COMMENTED" ]; then
@@ -70,4 +96,4 @@ jobs:
7096
else
7197
echo "PR #$PR_NUM already notified. Skipping."
7298
fi
73-
done
99+
done

0 commit comments

Comments
 (0)