Spaces:
				
			
			
	
			
			
		Build error
		
	
	
	
			
			
	
	
	
	
		
		
		Build error
		
	delete space on closed PR
Browse files
    	
        app.py
    CHANGED
    
    | @@ -101,15 +101,18 @@ async def post_webhook( | |
| 101 | 
             
                    and payload.event.action == "update"
         | 
| 102 | 
             
                    and payload.discussion is not None
         | 
| 103 | 
             
                    and payload.discussion.isPullRequest
         | 
| 104 | 
            -
                    and  | 
|  | |
|  | |
|  | |
| 105 | 
             
                ):
         | 
| 106 | 
            -
                    # PR merged!
         | 
| 107 | 
             
                    task_queue.add_task(
         | 
| 108 | 
             
                        delete_ci_space,
         | 
| 109 | 
             
                        space_id=space_id,
         | 
| 110 | 
             
                        pr_num=payload.discussion.num,
         | 
| 111 | 
             
                    )
         | 
| 112 | 
            -
                    logger.info("PR is merged! Delete task scheduled")
         | 
| 113 | 
             
                elif (
         | 
| 114 | 
             
                    payload.event.scope.startswith("repo.content")
         | 
| 115 | 
             
                    and payload.event.action == "update"
         | 
|  | |
| 101 | 
             
                    and payload.event.action == "update"
         | 
| 102 | 
             
                    and payload.discussion is not None
         | 
| 103 | 
             
                    and payload.discussion.isPullRequest
         | 
| 104 | 
            +
                    and (
         | 
| 105 | 
            +
                        payload.discussion.status == "merged"
         | 
| 106 | 
            +
                        or payload.discussion.status == "closed"
         | 
| 107 | 
            +
                    )
         | 
| 108 | 
             
                ):
         | 
| 109 | 
            +
                    # PR merged or closed!
         | 
| 110 | 
             
                    task_queue.add_task(
         | 
| 111 | 
             
                        delete_ci_space,
         | 
| 112 | 
             
                        space_id=space_id,
         | 
| 113 | 
             
                        pr_num=payload.discussion.num,
         | 
| 114 | 
             
                    )
         | 
| 115 | 
            +
                    logger.info("PR is merged (or closed)! Delete task scheduled")
         | 
| 116 | 
             
                elif (
         | 
| 117 | 
             
                    payload.event.scope.startswith("repo.content")
         | 
| 118 | 
             
                    and payload.event.action == "update"
         | 

