(header http.Header)
| 384 | } |
| 385 | |
| 386 | func prCommitFromHeader(header http.Header) string { |
| 387 | key := header.Get("x-commit-key") |
| 388 | if key == "" { |
| 389 | return "" |
| 390 | } |
| 391 | idx := strings.LastIndexByte(key, ':') |
| 392 | if idx < 0 || idx == len(key)-1 { |
| 393 | return "" |
| 394 | } |
| 395 | commit := key[idx+1:] |
| 396 | if !isCommitish(commit) { |
| 397 | return "" |
| 398 | } |
| 399 | return commit[:7] |
| 400 | } |