.
This commit is contained in:
parent
1db814b5d3
commit
87ab2e0af5
@ -839,3 +839,5 @@ const createTagJSON=`{
|
||||
"username": "adamm"
|
||||
}
|
||||
}`
|
||||
|
||||
|
||||
|
@ -88,7 +88,9 @@ func main() {
|
||||
res.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
|
||||
// repo := common.Repository{}
|
||||
org := common.Organization{}
|
||||
extraAction := ""
|
||||
|
||||
switch reqType {
|
||||
case "create", "delete":
|
||||
create := common.CreateWebhookEvent{}
|
||||
@ -99,7 +101,8 @@ func main() {
|
||||
}
|
||||
return
|
||||
}
|
||||
// repo = create.Repository
|
||||
org = *create.Repository.Owner
|
||||
|
||||
case "fork":
|
||||
fork := common.ForkWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &fork); err != nil {
|
||||
@ -109,7 +112,7 @@ func main() {
|
||||
}
|
||||
return
|
||||
}
|
||||
// repo = fork.Forkee
|
||||
org = *fork.Forkee.Owner
|
||||
case "push":
|
||||
push := common.PushRequest{}
|
||||
if err = json.Unmarshal(data, &push); err != nil {
|
||||
@ -119,13 +122,25 @@ func main() {
|
||||
}
|
||||
return
|
||||
}
|
||||
// repo = push.Repository
|
||||
org = *push.Repository.Owner
|
||||
case "repository":
|
||||
repoAction := common.RepositoryAction{}
|
||||
if err = json.Unmarshal(data, &repoAction); err != nil {
|
||||
res.WriteHeader(http.StatusBadRequest)
|
||||
if DebugMode {
|
||||
dumpUnhandledData(reqType, data)
|
||||
}
|
||||
return
|
||||
}
|
||||
org = repoAction.Organization
|
||||
extraAction = repoAction.Action
|
||||
}
|
||||
|
||||
// err = PublishMessage(repo.Owner.Username, reqType, data)
|
||||
// write to file for review
|
||||
os.WriteFile("test_data."+fmt.Sprint(connectionId), data, 0644)
|
||||
connectionId++
|
||||
log.Println(id, org.Username, extraAction)
|
||||
|
||||
/*
|
||||
err = PublishMessage(repo.Name, reqType, data)
|
||||
|
Loading…
Reference in New Issue
Block a user