Skip to content

Commit 431bb4b

Browse files
authored
feat: Add fortnightly office hour reminder bot (#906)
Signed-off-by: Adityarya11 <arya050411@gmail.com>
1 parent 899133b commit 431bb4b

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: PythonBot - Office Hour Reminder
2+
3+
on:
4+
# push:
5+
schedule:
6+
- cron: '0 10 * * 3'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
office-hour-reminder:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Harden the runner
18+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2
19+
with:
20+
egress-policy: audit
21+
22+
- name: Check Schedule and Notify
23+
env:
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
run: |
26+
ANCHOR_DATE="2025-12-03"
27+
MEETING_LINK="https://zoom-lfx.platform.linuxfoundation.org/meeting/99912667426?password=5b584a0e-1ed7-49d3-b2fc-dc5ddc888338"
28+
CALENDAR_LINK="https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week"
29+
30+
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')")
31+
32+
if [ "$IS_MEETING_WEEK" = "false" ]; then
33+
echo "Not a fortnightly meeting week. Skipping execution."
34+
exit 0
35+
fi
36+
37+
echo "Meeting week detected. Proceeding to notify open PRs."
38+
39+
REPO="${{ github.repository }}"
40+
PR_LIST=$(gh pr list --repo $REPO --state open --json number --jq '.[].number')
41+
42+
if [ -z "$PR_LIST" ]; then
43+
echo "No open PRs found."
44+
exit 0
45+
fi
46+
47+
COMMENT_BODY=$(cat <<EOF
48+
Hello, this is the Office Hour Bot.
49+
50+
This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 hours (14:00 UTC).
51+
52+
This session provides an opportunity to ask questions regarding this Pull Request or receive assistance from a maintainer.
53+
54+
Details:
55+
- Time: 14:00 UTC
56+
- Join Link: [Zoom Meeting]($MEETING_LINK)
57+
58+
Disclaimer: This is an automated reminder. Please verify the schedule [here]($CALENDAR_LINK) to be notified of any changes.
59+
EOF
60+
)
61+
62+
for PR_NUM in $PR_LIST; do
63+
echo "Processing PR #$PR_NUM"
64+
65+
ALREADY_COMMENTED=$(gh pr view $PR_NUM --repo $REPO --json comments --jq '.comments[].body' | grep -F "Office Hour Bot" || true)
66+
67+
if [ -z "$ALREADY_COMMENTED" ]; then
68+
gh pr comment $PR_NUM --repo $REPO --body "$COMMENT_BODY"
69+
echo "Reminder posted to PR #$PR_NUM"
70+
else
71+
echo "PR #$PR_NUM already notified. Skipping."
72+
fi
73+
done

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
99
### Added
1010
- Add example demonstrating usage of `CustomFeeLimit` in `examples/transaction/custom_fee_limit.py`
1111
- Added `.github/workflows/merge-conflict-bot.yml` to automatically detect and notify users of merge conflicts in Pull Requests.
12+
- Added `.github/workflows/bot-office-hours.yml` to automate the Weekly Office Hour Reminder.
1213

1314
### Changed
1415

0 commit comments

Comments
 (0)