From 167c95bb0347fe019f65466df94fac99cd612c9b Mon Sep 17 00:00:00 2001 From: davidvader Date: Tue, 4 Jun 2024 10:28:05 -0500 Subject: [PATCH] enhance: use repo owner token in schedule processing --- cmd/vela-server/schedule.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/vela-server/schedule.go b/cmd/vela-server/schedule.go index e7e0df759..3709df9a8 100644 --- a/cmd/vela-server/schedule.go +++ b/cmd/vela-server/schedule.go @@ -180,16 +180,10 @@ func processSchedule(ctx context.Context, s *api.Schedule, settings *settings.Pl b.SetRepo(r) b.SetSender(s.GetUpdatedBy()) - // send API call to capture the user for the schedule trigger - u, err := database.GetUserForName(ctx, s.GetUpdatedBy()) - if err != nil { - return fmt.Errorf("unable to get user for name %s: %w", s.GetUpdatedBy(), err) - } - // fetch scm user id - senderID, err := scm.GetUserID(ctx, u.GetName(), u.GetToken()) + senderID, err := scm.GetUserID(ctx, s.GetUpdatedBy(), r.GetOwner().GetToken()) if err != nil { - return fmt.Errorf("unable to get SCM user id for %s: %w", u.GetName(), err) + return fmt.Errorf("unable to get SCM user id for %s: %w", s.GetUpdatedBy(), err) } b.SetSenderSCMID(senderID)