Skip to content

Commit 2906d4f

Browse files
committed
Gitea fixes
Allow http URL for gitea if we run with it (which could be common for devs) Gitea calls syncronized instead of Github's synchronize so add that Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent 9c17948 commit 2906d4f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/content/dev/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ spec:
9191
webhook_secret:
9292
name: "secret"
9393
key: "webhook"
94-
9594
---
9695
apiVersion: v1
9796
kind: Secret
@@ -108,6 +107,7 @@ There is some gotchas with the webhook validation secret, Pipelines as Code
108107
detect a Gitea install and let the user set a empty webhook secret (by default
109108
it's enforced).
110109
110+
Gitops comment like `/retest` or `/ok-to-test` is not working at the moment.
111111
Other than that YMMV, feel free to raise a bug if you find some.
112112

113113
## Debugging controller

pkg/provider/github/events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (v *Provider) getAppToken(ctx context.Context, kube kubernetes.Interface, g
4949
}
5050

5151
if gheURL != "" {
52-
if !strings.HasPrefix(gheURL, "https://") {
52+
if !strings.HasPrefix(gheURL, "https://") && !strings.HasPrefix(gheURL, "http://") {
5353
gheURL = "https://" + gheURL
5454
}
5555
v.Client, _ = github.NewEnterpriseClient(gheURL, "", &http.Client{Transport: itr})

pkg/provider/github/github.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (v *Provider) SetClient(ctx context.Context, event *info.Event) error {
9999
var client *github.Client
100100
apiURL := event.Provider.URL
101101
if apiURL != "" {
102-
if !strings.HasPrefix(apiURL, "https") {
102+
if !strings.HasPrefix(apiURL, "https") && !strings.HasPrefix(apiURL, "http") {
103103
apiURL = "https://" + apiURL
104104
}
105105
}
@@ -328,7 +328,7 @@ func (v *Provider) Detect(reqHeader *http.Header, payload string, logger *zap.Su
328328
return setLoggerAndProceed(false, "push: no pusher in event", nil)
329329

330330
case *github.PullRequestEvent:
331-
if provider.Valid(gitEvent.GetAction(), []string{"opened", "synchronize", "reopened"}) {
331+
if provider.Valid(gitEvent.GetAction(), []string{"opened", "synchronize", "synchronized", "reopened"}) {
332332
return setLoggerAndProceed(true, "", nil)
333333
}
334334
return setLoggerAndProceed(false, fmt.Sprintf("pull_request: unsupported action \"%s\"", gitEvent.GetAction()), nil)

0 commit comments

Comments
 (0)