Skip to content

Commit

Permalink
Fix metrics emission for GitHubApp Enterprise
Browse files Browse the repository at this point in the history
Now PAC will emit metrics for
GitHub Enterprise App

Signed-off-by: Savita Ashture sashture@redhat.com
  • Loading branch information
savitaashture committed Mar 22, 2024
1 parent ee28faa commit 53e8d73
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/reconciler/emit_metrics.go
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ func (r *Reconciler) emitMetrics(pr *tektonv1.PipelineRun) error {
eventType := pr.GetAnnotations()[keys.EventType]

switch gitProvider {
case "github":
case "github", "github-enterprise":
if _, ok := pr.GetAnnotations()[keys.InstallationID]; ok {
gitProvider += "-app"
} else {
9 changes: 9 additions & 0 deletions pkg/reconciler/emit_metrics_test.go
Original file line number Diff line number Diff line change
@@ -25,6 +25,15 @@ func TestEmitMetrics(t *testing.T) {
},
wantErr: false,
},
{
name: "provider is GitHub Enterprise App",
annotations: map[string]string{
keys.GitProvider: "github-enterprise",
keys.EventType: "pull_request",
keys.InstallationID: "123",
},
wantErr: false,
},
{
name: "provider is GitHub Webhook",
annotations: map[string]string{

0 comments on commit 53e8d73

Please sign in to comment.