Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ linters:
- whitespace
- zerologlint
settings:
govet:
disable:
- inline
misspell:
ignore-rules:
- cancelled
Expand Down
8 changes: 7 additions & 1 deletion .tekton/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ spec:
value: $(workspaces.source.path)/go-build-cache/cache
- name: GOMODCACHE
value: $(workspaces.source.path)/go-build-cache/mod
- name: GOTOOLCHAIN
value: go1.25.0
workingDir: $(workspaces.source.path)
script: |
#!/usr/bin/env bash
Expand All @@ -82,6 +84,8 @@ spec:
value: $(workspaces.source.path)/go-build-cache/cache
- name: GOMODCACHE
value: $(workspaces.source.path)/go-build-cache/mod
- name: GOTOOLCHAIN
value: go1.25.0
- name: GITHUB_REPOSITORY
value: "{{repo_owner}}/{{repo_name}}"
- name: GITHUB_PULL_REQUEST_ID
Expand All @@ -97,13 +101,15 @@ spec:
chmod +x ./codecov
./codecov -P $GITHUB_PULL_REQUEST_ID -C {{revision}} -v
- name: lint
image: docker.io/golangci/golangci-lint:v2.10.1
image: docker.io/golang:1.25
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Docker image docker.io/golang:1.25 does not exist because Go 1.25 is not a released version. This will cause the Tekton lint task to fail to pull the image and run. Please use a valid, released Go version image such as docker.io/golang:1.23.

              image: docker.io/golang:1.23

workingDir: $(workspaces.source.path)
env:
- name: GOCACHE
value: $(workspaces.source.path)/go-build-cache/cache
- name: GOMODCACHE
value: $(workspaces.source.path)/go-build-cache/mod
- name: GOTOOLCHAIN
value: go1.25.0
- name: GOLANGCILINT_CACHE
value: $(workspaces.source.path)/go-build-cache/golangci-cache
script: |
Expand Down
28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
TARGET_NAMESPACE=pipelines-as-code
HUGO_VERSION=0.146.0
HTMLTEST_VERSION=0.17.0
GOLANGCI_LINT=golangci-lint
GOLANGCI_LINT_VERSION ?= v2.12.2
GO_TOOLCHAIN ?= go1.25.0
Comment on lines +4 to +5
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The pinned versions for GOLANGCI_LINT_VERSION (v2.12.2) and GO_TOOLCHAIN (go1.25.0) do not exist. golangci-lint does not have a v2.x release (it is currently on v1.x), and Go 1.25.0 is not a released version of Go. Using these non-existent versions will cause local builds and linter runs to fail.

GOLANGCI_LINT_VERSION ?= v1.62.2
GO_TOOLCHAIN ?= go1.23.0

GOFUMPT=gofumpt
TKN_BINARY_NAME := tkn
TKN_BINARY_URL := https://tekton.dev/docs/cli/\#installation
Expand All @@ -12,12 +13,21 @@ TIMEOUT_UNIT = 20m
TIMEOUT_E2E = 45m
DEFAULT_GO_TEST_FLAGS := -race -failfast
GO_TEST_FLAGS :=
GOTOOLCHAIN ?= $(GO_TOOLCHAIN)
export GOTOOLCHAIN

SHELL := bash
TOPDIR := $(shell git rev-parse --show-toplevel)
TMPDIR := $(TOPDIR)/tmp
HUGO_BIN := $(TMPDIR)/hugo/hugo
HTMLTEST_BIN := $(TMPDIR)/htmltest/htmltest
GOLANGCI_LINT_OS ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
GOLANGCI_LINT_ARCH ?= $(shell uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')
GOLANGCI_LINT_PACKAGE := golangci-lint-$(patsubst v%,%,$(GOLANGCI_LINT_VERSION))-$(GOLANGCI_LINT_OS)-$(GOLANGCI_LINT_ARCH)
GOLANGCI_LINT_DIR := $(TMPDIR)/golangci-lint/$(GOLANGCI_LINT_VERSION)
GOLANGCI_LINT_BIN := $(GOLANGCI_LINT_DIR)/golangci-lint
GOLANGCI_LINT ?= $(GOLANGCI_LINT_BIN)
GOLANGCI_LINT_EXTRA_ARGS ?= --concurrency=1

# Safe file list helpers using null-delimited output
# Usage: $(call GIT_LS_FILES,<patterns>,<command>)
Expand Down Expand Up @@ -93,13 +103,21 @@ lint-e2e-naming: ## check e2e test naming conventions
@./hack/check-e2e-test-naming.sh

.PHONY: lint-go
lint-go: ## runs go linter on all go files
lint-go: golangci-lint ## runs go linter on all go files
@echo "Linting go files..."
@$(GOLANGCI_LINT) run ./pkg/... ./test/... --modules-download-mode=vendor \
@$(GOLANGCI_LINT) run $(GOLANGCI_LINT_EXTRA_ARGS) ./pkg/... ./test/... --modules-download-mode=vendor \
--max-issues-per-linter=0 \
--max-same-issues=0 \
--timeout $(TIMEOUT_UNIT)

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT_BIN) ## download pinned golangci-lint into tmp

$(GOLANGCI_LINT_BIN):
@mkdir -p $(GOLANGCI_LINT_DIR)
@echo "Downloading golangci-lint $(GOLANGCI_LINT_VERSION) for $(GOLANGCI_LINT_OS)-$(GOLANGCI_LINT_ARCH)"
@curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/$(GOLANGCI_LINT_VERSION)/$(GOLANGCI_LINT_PACKAGE).tar.gz" | tar -xz -C "$(GOLANGCI_LINT_DIR)" --strip-components=1 "$(GOLANGCI_LINT_PACKAGE)/golangci-lint"

.PHONY: lint-yaml
lint-yaml: ## runs yamllint on all yaml files
@echo "Linting yaml files..."
Expand Down Expand Up @@ -158,9 +176,9 @@ fix-python-errors: ## fix all python errors generated by ruff
[[ -n "$$STATUS" ]] && { echo "Python files has been cleaned 🧹. Cleaned Files: "; echo "$$STATUS" ;} || echo "Python files are clean ✨"

.PHONY: fix-golangci-lint
fix-golangci-lint: ## run golangci-lint and fix on all go files
fix-golangci-lint: golangci-lint ## run golangci-lint and fix on all go files
@echo "Fixing some golangi-lint files..."
@$(GOLANGCI_LINT) run ./... --modules-download-mode=vendor \
@$(GOLANGCI_LINT) run $(GOLANGCI_LINT_EXTRA_ARGS) ./... --modules-download-mode=vendor \
--max-issues-per-linter=0 \
--max-same-issues=0 \
--timeout $(TIMEOUT_UNIT) \
Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/cloudevents/sdk-go/v2 v2.16.2
github.com/fvbommel/sortorder v1.1.0
github.com/gobwas/glob v0.2.3
github.com/google/cel-go v0.26.1
github.com/google/cel-go v0.27.0
github.com/google/go-cmp v0.7.0
github.com/google/go-github/scrape v0.0.0-20260114152324-5458fbc09dc5
github.com/google/go-github/v75 v75.0.0
Expand All @@ -27,7 +27,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
github.com/tektoncd/pipeline v1.7.0
github.com/tektoncd/pipeline v1.9.3
gitlab.com/gitlab-org/api/client-go v1.14.0
go.opencensus.io v0.24.0
go.uber.org/zap v1.27.1
Expand All @@ -54,8 +54,8 @@ require (
github.com/cloudevents/sdk-go/sql/v2 v2.16.2 // indirect
github.com/coreos/go-oidc/v3 v3.17.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
github.com/go-jose/go-jose/v3 v3.0.5 // indirect
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
github.com/go-openapi/errors v0.22.6 // indirect
github.com/go-openapi/strfmt v0.25.0 // indirect
github.com/go-openapi/swag/cmdutils v0.25.4 // indirect
Expand Down Expand Up @@ -136,7 +136,6 @@ require (
github.com/prometheus/statsd_exporter v0.28.0 // indirect
github.com/rickb777/date v1.22.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/stoewer/go-strcase v1.3.1 // indirect
github.com/xlzd/gotp v0.1.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand All @@ -160,7 +159,7 @@ require (
)

replace (
github.com/go-jose/go-jose/v4 => github.com/go-jose/go-jose/v4 v4.0.5
github.com/go-jose/go-jose/v4 => github.com/go-jose/go-jose/v4 v4.1.4
github.com/google/gnostic-models => github.com/google/gnostic-models v0.6.9
k8s.io/api => k8s.io/api v0.32.8
k8s.io/apimachinery => k8s.io/apimachinery v0.32.8
Expand Down
34 changes: 16 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e/go.mod h1:RCMrTZv
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE=
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ=
github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down Expand Up @@ -245,8 +245,8 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ=
github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
github.com/google/cel-go v0.27.0 h1:e7ih85+4qVrBuqQWTW4FKSqZYokVuc3HnhH5keboFTo=
github.com/google/cel-go v0.27.0/go.mod h1:tTJ11FWqnhw5KKpnWpvW9CJC3Y9GK4EIS0WXnBbebzw=
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -474,8 +474,6 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs=
github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -492,8 +490,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc=
github.com/tektoncd/pipeline v1.7.0 h1:+Rd/YGpxV8sgEmW9unSiS8RgBE4DqbPdz6zPh2pYDnk=
github.com/tektoncd/pipeline v1.7.0/go.mod h1:+HsDce5knjq77Xv9FWg1W2wTuJRznR9lLEbkVjo62lU=
github.com/tektoncd/pipeline v1.9.3 h1:7Z+V2VX5wjz9LoNa16E1RbgH9mpYy5B1KnAMm3H0czc=
github.com/tektoncd/pipeline v1.9.3/go.mod h1:pEruzPp4JM8JK8Nnnih46IPgdtxRPot/i9pUZo8lA9I=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
Expand All @@ -519,16 +517,16 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
Expand Down
3 changes: 2 additions & 1 deletion pkg/adapter/incoming.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (l *listener) detectIncoming(ctx context.Context, req *http.Request, payloa
return false, nil, nil
}

l.logger.Infof("incoming request has been requested: %v", req.URL)
l.logger.Infof("incoming request has been requested: %v", req.URL.Path)
payload, err := parseIncomingPayload(req, payloadBody)
if payload.legacyMode {
// Log this, even if the request is invalid
Expand Down Expand Up @@ -183,6 +183,7 @@ func (l *listener) detectIncoming(ctx context.Context, req *http.Request, payloa
return false, nil, err
}
l.event.Provider.URL = enterpriseURL
l.event.GHEURL = enterpriseURL
l.event.Provider.Token = token
l.event.InstallationID = installationID
// Github app is not installed for provided repository url
Expand Down
7 changes: 1 addition & 6 deletions pkg/adapter/sinker.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ func (s *sinker) processEventPayload(ctx context.Context, request *http.Request)
}

func (s *sinker) processEvent(ctx context.Context, request *http.Request) error {
if s.event.EventType == "incoming" {
if request.Header.Get("X-GitHub-Enterprise-Host") != "" {
s.event.Provider.URL = request.Header.Get("X-GitHub-Enterprise-Host")
s.event.GHEURL = request.Header.Get("X-GitHub-Enterprise-Host")
}
} else {
if s.event.EventType != "incoming" {
if err := s.processEventPayload(ctx, request); err != nil {
return err
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/provider/github/app/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/url"
"strings"

"github.com/openshift-pipelines/pipelines-as-code/pkg/apis/pipelinesascode/keys"
"github.com/openshift-pipelines/pipelines-as-code/pkg/apis/pipelinesascode/v1alpha1"
"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
"github.com/openshift-pipelines/pipelines-as-code/pkg/provider/github"
Expand Down Expand Up @@ -65,9 +66,12 @@ func (ip *Install) GetAndUpdateInstallationID(ctx context.Context) (string, stri
return "", "", 0, fmt.Errorf("github client APIURL is nil")
}
apiURL := *ip.ghClient.APIURL
enterpriseHost := ip.request.Header.Get("X-GitHub-Enterprise-Host")
if enterpriseHost != "" {
apiURL = fmt.Sprintf("https://%s/api/v3", strings.TrimSuffix(enterpriseHost, "/"))
enterpriseHost := ""
if repoURL.Host != "" && repoURL.Host != "github.com" {
enterpriseHost = repoURL.Host
if apiURL == keys.PublicGithubAPIURL {
apiURL = fmt.Sprintf("https://%s/api/v3", strings.TrimSuffix(enterpriseHost, "/"))
}
}

client, _, _ := github.MakeClient(ctx, apiURL, jwtToken)
Expand Down
Loading
Loading