-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-webhooks.sh
More file actions
executable file
·80 lines (71 loc) · 1.99 KB
/
start-webhooks.sh
File metadata and controls
executable file
·80 lines (71 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
# Start gh webhook forwarders for all Loqu8 repos.
# Each runs in the background, forwarding issue events to conductor on :9999.
#
# Usage:
# ./start-webhooks.sh # start all
# ./start-webhooks.sh ice # start just one repo
#
# Stop:
# kill $(cat /tmp/conductor-webhooks-*.pid)
set -euo pipefail
CONDUCTOR_URL="http://localhost:9999/webhooks"
PID_DIR="/tmp"
EVENTS="issues,issue_comment"
REPOS=(
"loqu8/nomad-builder"
"loqu8/loqu8-dart"
"loqu8/ice"
"loqu8/copyworks"
"loqu8/intuition"
"loqu8/zhcorpus"
"loqu8/copybot"
"loqu8/loqu8.com"
"loqu8/strongs"
"srclight/srclight"
)
start_forwarder() {
local repo="$1"
local safe_name="${repo//\//-}"
local pid_file="${PID_DIR}/conductor-webhooks-${safe_name}.pid"
# Check if already running
if [[ -f "$pid_file" ]] && kill -0 "$(cat "$pid_file")" 2>/dev/null; then
echo " ✓ ${repo} already running (pid $(cat "$pid_file"))"
return
fi
echo " Starting ${repo}..."
gh webhook forward \
--events="$EVENTS" \
--repo="$repo" \
--url="$CONDUCTOR_URL" \
&>/dev/null &
local pid=$!
echo "$pid" > "$pid_file"
echo " ✓ ${repo} started (pid ${pid})"
}
if [[ $# -gt 0 ]]; then
# Start specific repo(s)
for arg in "$@"; do
# Allow short names like "ice" → "loqu8/ice"
matched=false
for repo in "${REPOS[@]}"; do
if [[ "$repo" == *"$arg"* ]]; then
start_forwarder "$repo"
matched=true
break
fi
done
if [[ "$matched" == false ]]; then
echo " ✗ No repo matching '$arg'"
fi
done
else
echo "Starting webhook forwarders for ${#REPOS[@]} repos → ${CONDUCTOR_URL}"
echo ""
for repo in "${REPOS[@]}"; do
start_forwarder "$repo"
done
fi
echo ""
echo "Done. Conductor should be running on :9999"
echo "Stop all: kill \$(cat /tmp/conductor-webhooks-*.pid)"