Commit 7b5d4ca
authored
KAFKA-20362 Fall back to GitHub handle when reviewer email is unavailable (#22108)
Fix #21928 (comment).
When a reviewer has "Keep my email addresses private" enabled, their
real email is unreachable through either the commits API (GitHub
rewrites the author email to the `@users.noreply.github.com` form on
squash-merge) or the GitHub user profile (which typically returns null).
The previous script wrote that noreply email, or a
`{login}@email-not-found` placeholder when both tiers missed, into the
`Reviewers:` trailer -- neither identifies the reviewer.
This PR adds two fallbacks, in order:
1. **Tier 3 -- past Reviewers: trailers in `git log`.** Once a reviewer
has been credited with a real email in any earlier merged PR, match
by name and reuse that email. This makes real-email attribution
"sticky" even after a reviewer later enables email privacy on
GitHub.
2. **`Name (@login)` fallback.** When no usable email can be resolved
from any tier, fall back to the GitHub handle, which is stable,
public, and unambiguously identifies the reviewer.
Reviewers whose real email is recoverable from any tier continue to use
the existing `Name <email>` form.
Kafka committers typically count reviewer contributions by grepping `git
log` for the reviewer's name, e.g., `git log | grep -i Reviewer | grep
-i "Ming-Yen Chung" | wc -l`. Since the name portion is preserved in
both `<email>` and `(@login)` forms, this change does not affect those
counts.
**For first-time reviewers who want to be credited by email instead of
`(@login)` (subsequent PRs are handled automatically by Tier 3):**
- **Tier 2 (works immediately, recommended):** set **Settings → Profile
→ Public email**. Verify with `gh api "users/<login>"` -- the `email`
field should be non-null.
- **Tier 1 (only after your first merged commit in apache/kafka):**
disable **Settings → Emails → Keep my email addresses private** before
committing. Verify with
`gh api "repos/apache/kafka/commits?author=<login>&per_page=1"` --
returns `[]` if you have no commits in the repo yet, and the author
email is the noreply form if privacy was on at commit time.
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>1 parent a3f1732 commit 7b5d4ca
1 file changed
Lines changed: 56 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
117 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
| |||
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
126 | | - | |
| 136 | + | |
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
130 | | - | |
| 140 | + | |
| 141 | + | |
131 | 142 | | |
132 | 143 | | |
133 | 144 | | |
| |||
137 | 148 | | |
138 | 149 | | |
139 | 150 | | |
140 | | - | |
| 151 | + | |
141 | 152 | | |
142 | 153 | | |
143 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
144 | 179 | | |
145 | 180 | | |
146 | 181 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | 182 | | |
151 | 183 | | |
152 | 184 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
157 | 192 | | |
158 | 193 | | |
159 | 194 | | |
| |||
207 | 242 | | |
208 | 243 | | |
209 | 244 | | |
210 | | - | |
211 | 245 | | |
212 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
213 | 253 | | |
214 | | - | |
215 | 254 | | |
216 | 255 | | |
217 | 256 | | |
| |||
0 commit comments