-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathsend-contributor-survey.sh
More file actions
executable file
ยท154 lines (112 loc) ยท 5.68 KB
/
Copy pathsend-contributor-survey.sh
File metadata and controls
executable file
ยท154 lines (112 loc) ยท 5.68 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env bash
# send-contributor-survey.sh โ ๅฐ็ฌฌไธๆฌก่ฒข็ป็ไบบ็ผ้ onboarding survey
#
# ็จๆณ:
# bash scripts/tools/send-contributor-survey.sh <username> <pr-number>
#
# ็ฏไพ:
# bash scripts/tools/send-contributor-survey.sh ceruleanstring 437
#
# ็บไป้บผ manual ่้ GitHub Actions๏ผfork PR ็ workflow ๆฌ้ fragile๏ผ
# ๅฟ่ทณ Beat 3 review PR ๆๆๅ่งธ็ผๆดๅฏ้ ใ่ฉณ่ฆ docs/community/CONTRIBUTOR-SURVEY.md
set -uo pipefail
if [[ $# -lt 2 ]]; then
echo "็จๆณ: $0 <username> <pr-number>"
echo "็ฏไพ: $0 ceruleanstring 437"
exit 1
fi
USERNAME="$1"
PR_NUMBER="$2"
# Check if user has already received survey
SURVEY_LOG="docs/community/contributor-stories/.survey-sent.txt"
mkdir -p "$(dirname "$SURVEY_LOG")"
touch "$SURVEY_LOG"
if grep -q "^${USERNAME}$" "$SURVEY_LOG" 2>/dev/null; then
echo "โ ๏ธ $USERNAME already received survey (in $SURVEY_LOG)"
echo " To force resend: remove the line and re-run"
exit 0
fi
# Detect language preference from PR title (rough heuristic)
PR_TITLE=$(gh pr view "$PR_NUMBER" --json title 2>/dev/null | python3 -c "import json,sys;print(json.load(sys.stdin)['title'])" 2>/dev/null)
LANG_HINT="default"
case "$PR_TITLE" in
*Korean*|*ko/*) LANG_HINT="korean" ;;
*Japanese*|*ja/*) LANG_HINT="japanese" ;;
*French*|*fr/*) LANG_HINT="french" ;;
*Spanish*|*es/*) LANG_HINT="spanish" ;;
esac
# Templates stored as files in case bash heredoc parsing trips
TEMPLATE_DIR="$(dirname "$0")/contributor-survey-templates"
mkdir -p "$TEMPLATE_DIR"
# Generate templates on first run
if [[ ! -f "$TEMPLATE_DIR/default.md" ]]; then
cat > "$TEMPLATE_DIR/default.md" <<'TEMPLATE_END'
๐ Hi @USERNAME, your first PR has been merged โ thank you for becoming a Taiwan.md clownfish ๐
We want to understand contributor stories to help Taiwan.md become a better community. If you have 2 minutes, could you answer some of these questions in a comment? Any single answer is valuable โ you don't have to answer all.
---
**1. How did you find Taiwan.md?**
Search engine? Friend? Social media? Which article?
**2. Did you hesitate before your first contribution? What made you decide to send a PR?**
**3. Did the first PR experience make you want to send another? Why or why not?**
Was the workflow smooth? Response speed? Where was it uncomfortable?
**4. Was there any friction that made you want to give up?**
Technical barriers, unclear docs, strict rules, slow merge โ anything.
**5. Would you be willing to be contacted for further conversation?**
If yes: leave your preferred contact โ Email / Twitter / Telegram / Threads / anything.
---
You don't need to answer all. Even "Q1: found via Threads" is valuable.
โโ Taiwan.md Maintainer
TEMPLATE_END
fi
if [[ ! -f "$TEMPLATE_DIR/korean.md" ]]; then
cat > "$TEMPLATE_DIR/korean.md" <<'TEMPLATE_END'
๐ ์๋
ํ์ธ์ @USERNAME, ์ฒซ ๋ฒ์งธ PR์ด ๋จธ์ง๋์์ต๋๋ค. Taiwan.md์ ์์ ๊ด๋๋ฌผ๊ณ ๊ธฐ ๐ ๊ฐ ๋์ด ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.
์ ํฌ๋ ๊ธฐ์ฌ์๋ถ๋ค์ ์ด์ผ๊ธฐ๋ฅผ ์๊ณ ์ถ์ต๋๋ค. 2๋ถ ์ ๋ ์๊ฐ์ด ์์ผ์๋ฉด ์๋ ์ง๋ฌธ์ ๋ตํด์ฃผ์ค ์ ์์๊น์? ํ ์ง๋ฌธ๋ง ๋ตํด๋ ๊ด์ฐฎ์ต๋๋ค.
---
**1. Taiwan.md๋ฅผ ์ด๋ป๊ฒ ์๊ฒ ๋์
จ๋์?**
๊ฒ์? ์น๊ตฌ ์ถ์ฒ? SNS? ์ด๋ค ๊ธฐ์ฌ?
**2. ์ฒซ ๊ธฐ์ฌ ์ ์ ๋ง์ค์ด์
จ๋์? ๋ฌด์์ด PR์ ๋ณด๋ด๊ธฐ๋ก ๊ฒฐ์ ํ๊ฒ ํ๋์?**
**3. ์ฒซ PR ๊ฒฝํ์ด ๋ ๋ค๋ฅธ PR์ ๋ณด๋ด๊ณ ์ถ๊ฒ ๋ง๋ค์๋์? ์์?**
์ํฌํ๋ก์ฐ๋ ์ด๋ ๋์? ์๋ต ์๋? ์ด๋๊ฐ ๋ถํธํ๋์?
**4. ํฌ๊ธฐํ๊ณ ์ถ์๋ friction์ด ์์๋์?**
๊ธฐ์ ์ ์ฅ๋ฒฝ, ๋ฌธ์ ๋ถ์กฑ, ๊ท์ ์ด ๋๋ฌด ์๊ฒฉํจ, merge๊ฐ ๋๋ฌด ๋๋ฆผโฏโฏ
**5. ๊ณ์ ๋ํํ์๊ธฐ ์ํ์ ๋ค๋ฉด ์ฐ๋ฝ์ฒ๋ฅผ ๋จ๊ฒจ์ฃผ์ธ์.**
Email / Twitter / Telegram / Threads / ์ด๋ ๊ฒ์ด๋
---
์ ๋ถ ๋ตํ์ง ์์ผ์
๋ ๋ฉ๋๋ค. "1๋ฒ ๋ต: Threads์์ ๋ดค์ด์" ๊ฐ์ ํ ์ค๋ ํฐ ๋์์ด ๋ฉ๋๋ค.
โโ Taiwan.md Maintainer
TEMPLATE_END
fi
if [[ ! -f "$TEMPLATE_DIR/japanese.md" ]]; then
cat > "$TEMPLATE_DIR/japanese.md" <<'TEMPLATE_END'
๐ ใใใซใกใฏ @USERNAME, ๆๅใฎ PR ใใใผใธใใใพใใใTaiwan.md ใฎใฏใใใ ๐ ใซใชใฃใฆใใใฆใใใใจใใใใใพใใ
ๅฏ็จฟ่
ใฎ็ฉ่ชใ็ฅใใใใฎใงใ2 ๅใปใฉใใใฐไปฅไธใฎ่ณชๅใซ็ญใใฆใใใ ใใพใใ๏ผไธใคใ ใใงใๆงใใพใใใ
---
**1. Taiwan.md ใใฉใใใฃใฆ่ฆใคใใพใใใ?**
ๆค็ดข? ๅไบบใฎ็ดนไป? SNS? ใฉใฎ่จไบ?
**2. ๆๅใฎ่ฒข็ฎใฎๅใซ่ฟทใใพใใใ? ไฝใ PR ใ้ใใใจๆฑบใใใใพใใใ?**
**3. ๆๅใฎ PR ไฝ้จใฏๆฌกใฎ PR ใ้ใใใใใใพใใใ? ใชใใงใใ?**
ใฏใผใฏใใญใผใฏในใ ใผใบใงใใใ? ๅฟ็ญ้ๅบฆใฏ? ใฉใใไธๅฟซใงใใใ?
**4. ่ซฆใใใใชใ friction ใฏใใใพใใใ?**
ๆ่ก็้ๅฃใใใญใฅใกใณใไธ่ถณใ่ฆ็ฏใๅณใใใใใmerge ใ้
ใใใโฏโฏ
**5. ๅผใ็ถใ้ฃ็ตกใๅใใใใใฐ้ฃ็ตกๅ
ใๆใใฆใใ ใใใ**
Email / Twitter / Telegram / Threads / ไฝใงใ
---
ใในใฆ็ญใใๅฟ
่ฆใฏใใใพใใใใQ1: Threads ใง่ฆใคใใพใใใใฎใใใชไธ่กใงใๅคงใใชไพกๅคใใใใพใใ
โโ Taiwan.md Maintainer
TEMPLATE_END
fi
# Pick the template file
TEMPLATE_FILE="$TEMPLATE_DIR/${LANG_HINT}.md"
[[ ! -f "$TEMPLATE_FILE" ]] && TEMPLATE_FILE="$TEMPLATE_DIR/default.md"
# Substitute username
BODY=$(sed "s/USERNAME/${USERNAME}/g" "$TEMPLATE_FILE")
# Post comment
echo "๐จ Sending survey to @$USERNAME on PR #$PR_NUMBER (lang: $LANG_HINT)"
if gh pr comment "$PR_NUMBER" --body "$BODY" 2>&1; then
echo "$USERNAME" >> "$SURVEY_LOG"
echo "โ
Survey sent. Logged to $SURVEY_LOG"
else
echo "โ Failed to send comment"
exit 1
fi