Skip to content

Commit

Permalink
enhance: use repo owner token in schedule processing
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Jun 4, 2024
1 parent 82c8578 commit 167c95b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions cmd/vela-server/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 167c95b

Please sign in to comment.