Skip to content

Commit 87f0587

Browse files
committed
feat: community call bot
Signed-off-by: exploreriii <[email protected]>
1 parent 4f33085 commit 87f0587

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
DRY_RUN="${DRY_RUN:-true}"
5+
6+
ANCHOR_DATE="2025-11-12"
7+
MEETING_LINK="https://zoom-lfx.platform.linuxfoundation.org/meeting/92041330205?password=2f345bee-0c14-4dd5-9883-06fbc9c60581"
8+
CALENDAR_LINK="https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week"
9+
10+
EXCLUDED_AUTHORS=(
11+
"rbair23"
12+
"nadineloepfe"
13+
"exploreriii"
14+
"manishdait"
15+
"Dosik13"
16+
"hendrikebbers"
17+
)
18+
19+
if [ "$DRY_RUN" = "true" ]; then
20+
echo "=== DRY RUN MODE ENABLED ==="
21+
echo "No comments will be posted."
22+
fi
23+
24+
IS_MEETING_WEEK=$(python3 - <<EOF
25+
from datetime import date
26+
d1 = date.fromisoformat("$ANCHOR_DATE")
27+
d2 = date.today()
28+
print("true" if (d2 - d1).days % 14 == 0 else "false")
29+
EOF
30+
)
31+
32+
if [ "$IS_MEETING_WEEK" = "false" ]; then
33+
echo "Not a fortnightly meeting week. Exiting."
34+
exit 0
35+
fi
36+
37+
if [ -z "${GITHUB_REPOSITORY:-}" ]; then
38+
echo "ERROR: GITHUB_REPOSITORY is not set."
39+
exit 1
40+
fi
41+
42+
REPO="$GITHUB_REPOSITORY"
43+
44+
ISSUE_DATA=$(gh issue list \
45+
--repo "$REPO" \
46+
--state open \
47+
--json number,author,createdAt)
48+
49+
if [ -z "$ISSUE_DATA" ] || [ "$ISSUE_DATA" = "[]" ]; then
50+
echo "No open issues found."
51+
exit 0
52+
fi
53+
54+
COMMENT_BODY=$(cat <<EOF
55+
Hello, this is CommunityCallBot.
56+
57+
This is a reminder that the Hiero Python SDK Community Call will begin in approximately 4 hours (14:00 UTC).
58+
59+
The call is an open forum where contributors and users can discuss topics, raise issues, and influence the direction of the Python SDK.
60+
61+
Details:
62+
- Time: 14:00 UTC
63+
- Join Link: [Zoom Meeting]($MEETING_LINK)
64+
65+
Disclaimer: This is an automated reminder. Please verify the schedule [here]($CALENDAR_LINK) for any changes.
66+
EOF
67+
)
68+
69+
echo "$ISSUE_DATA" |
70+
jq -r '
71+
group_by(.author.login)
72+
| .[]
73+
| sort_by(.createdAt)
74+
| reverse
75+
| .[0]
76+
| "\(.number) \(.author.login)"
77+
' |
78+
while read ISSUE_NUM AUTHOR; do
79+
for EXCLUDED in "${EXCLUDED_AUTHORS[@]}"; do
80+
if [ "$AUTHOR" = "$EXCLUDED" ]; then
81+
echo "Skipping issue #$ISSUE_NUM by excluded author @$AUTHOR"
82+
continue 2
83+
fi
84+
done
85+
86+
ALREADY_COMMENTED=$(gh issue view "$ISSUE_NUM" \
87+
--repo "$REPO" \
88+
--json comments \
89+
--jq '.comments[].body' | grep -F "CommunityCallBot" || true)
90+
91+
if [ -n "$ALREADY_COMMENTED" ]; then
92+
echo "Issue #$ISSUE_NUM already notified. Skipping."
93+
continue
94+
fi
95+
96+
if [ "$DRY_RUN" = "true" ]; then
97+
echo "----------------------------------------"
98+
echo "[DRY RUN] Would comment on issue #$ISSUE_NUM"
99+
echo "[DRY RUN] Author: @$AUTHOR"
100+
echo "----------------------------------------"
101+
echo "$COMMENT_BODY"
102+
echo "----------------------------------------"
103+
else
104+
gh issue comment "$ISSUE_NUM" --repo "$REPO" --body "$COMMENT_BODY"
105+
echo "Reminder posted to issue #$ISSUE_NUM"
106+
fi
107+
done
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PythonBot - Office Hour Reminder
2+
3+
on:
4+
schedule:
5+
- cron: "0 10 * * 3"
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
office-hour-reminder:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Harden the runner
16+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 #2.14.0
17+
with:
18+
egress-policy: audit
19+
20+
- name: Checkout repository
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
22+
23+
- name: Check Schedule and Notify
24+
env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
DRY_RUN: "false" # will post
27+
run: |
28+
bash ./scripts/bot-office-hours.sh

0 commit comments

Comments
 (0)