Skip to content

Commit f6f6a7f

Browse files
committed
Prefix context when searching for existing status
1 parent 6f3bbe6 commit f6f6a7f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/github/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ func FetchRefStat(repo, ref, statName, apiToken string) (string, error) {
3838
return "", err
3939
}
4040

41+
context := githubContextForStatName(statName)
42+
4143
for _, status := range refStatus.Statuses {
42-
if status.Context == statName {
44+
if status.Context == context {
4345
return commitstatStatus.ParseStatFromDescription(status.Description), nil
4446
}
4547
}
@@ -56,7 +58,7 @@ func SubmitStatus(repo, sha, statName string, status *commitstatStatus.Status, a
5658
State: string(status.State),
5759
Description: status.Description,
5860
TargetURL: targetURL,
59-
Context: "commitstat/" + statName,
61+
Context: githubContextForStatName(statName),
6062
}
6163
githubStatusJSON, _ := json.Marshal(githubStatus)
6264
statusesURL := fmt.Sprintf("/repos/%s/statuses/%s", repo, sha)
@@ -72,6 +74,10 @@ func SubmitStatus(repo, sha, statName string, status *commitstatStatus.Status, a
7274
return nil
7375
}
7476

77+
func githubContextForStatName(statName string) string {
78+
return "commitstat/" + statName
79+
}
80+
7581
func request(verb string, url string, input []byte, apiToken string) (*http.Response, string, error) {
7682
baseUrl := "https://api.github.com"
7783
if overrideURL := os.Getenv("GITHUB_API_URL"); overrideURL != "" {

0 commit comments

Comments
 (0)