@@ -193,18 +193,6 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
193193 slog .Debug ("Added eyes reaction to comment" , "commentId" , commentIdStr )
194194 }
195195
196- if ! config .AllowDraftPRs && isDraft {
197- slog .Info ("Draft PRs are disabled, skipping" ,
198- "issueNumber" , issueNumber ,
199- "isDraft" , isDraft ,
200- )
201- if os .Getenv ("DIGGER_REPORT_BEFORE_LOADING_CONFIG" ) == "1" {
202- // This one is for aggregate reporting
203- commentReporterManager .UpdateComment (":construction_worker: Ignoring event as it is a draft and draft PRs are configured to be ignored" )
204- }
205- return nil
206- }
207-
208196 commentReporter , err := commentReporterManager .UpdateComment (":construction_worker: Digger starting.... config loaded successfully" )
209197 if err != nil {
210198 slog .Error ("Error initializing comment reporter" ,
@@ -339,6 +327,35 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
339327 return fmt .Errorf ("error processing event" )
340328 }
341329
330+ if ! config .AllowDraftPRs && isDraft {
331+ slog .Info ("Draft PRs are disabled, skipping" ,
332+ "issueNumber" , issueNumber ,
333+ "isDraft" , isDraft ,
334+ )
335+
336+ if os .Getenv ("DIGGER_REPORT_BEFORE_LOADING_CONFIG" ) == "1" {
337+ // This one is for aggregate reporting
338+ commentReporterManager .UpdateComment (":construction_worker: Ignoring event as it is a draft and draft PRs are configured to be ignored" )
339+ }
340+
341+ // special case to unlock all locks aquired by this PR
342+ if * diggerCommand == scheduler .DiggerCommandUnlock {
343+ err := models .DB .DeleteAllLocksAcquiredByPR (issueNumber , repoFullName , orgId )
344+ if err != nil {
345+ slog .Error ("Failed to delete locks" ,
346+ "prNumber" , issueNumber ,
347+ "command" , * diggerCommand ,
348+ "error" , err ,
349+ )
350+ commentReporterManager .UpdateComment (fmt .Sprintf (":x: Failed to delete locks: %v" , err ))
351+ return fmt .Errorf ("failed to delete locks: %v" , err )
352+ }
353+ commentReporterManager .UpdateComment (fmt .Sprintf (":white_check_mark: Command %v completed successfully" , * diggerCommand ))
354+ }
355+
356+ return nil
357+ }
358+
342359 // perform unlocking in backend
343360 if config .PrLocks {
344361 slog .Info ("Processing PR locks for impacted projects" ,
0 commit comments