disable commit status API for cron jobs

This commit is contained in:
Brad Rydzewski 2019-07-29 19:18:25 -07:00
parent d06e688e8a
commit 1e4774af4d
3 changed files with 7 additions and 2 deletions

View file

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- disable github status for cron jobs
## [1.2.2] - 2019-07-29
### Added

View file

@ -49,7 +49,7 @@ type service struct {
}
func (s *service) Send(ctx context.Context, user *core.User, req *core.StatusInput) error {
if s.disabled {
if s.disabled || req.Build.Trigger == core.TriggerCron {
return nil
}

View file

@ -102,7 +102,7 @@ func TestStatus_RenewalError(t *testing.T) {
mockRenewer.EXPECT().Renew(gomock.Any(), mockUser, false).Return(scm.ErrNotAuthorized)
service := New(nil, mockRenewer, Config{Base: "https://drone.company.com"})
err := service.Send(noContext, mockUser, nil)
err := service.Send(noContext, mockUser, &core.StatusInput{Build: &core.Build{}})
if err == nil {
t.Errorf("Expect error refreshing token")
}