mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-11-01 01:21:18 +01:00 
			
		
		
		
	Update PR-Demo-cleanup.yml
This commit is contained in:
		
							parent
							
								
									d591874da6
								
							
						
					
					
						commit
						c239d95131
					
				
							
								
								
									
										16
									
								
								.github/workflows/PR-Demo-cleanup.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/PR-Demo-cleanup.yml
									
									
									
									
										vendored
									
									
								
							@ -10,6 +10,7 @@ permissions:
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  SERVER_IP: ${{ secrets.VPS_IP }}  # Add this to your GitHub secrets
 | 
			
		||||
  CLEANUP_PERFORMED: 'false'  # Add flag to track if cleanup occurred
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  cleanup:
 | 
			
		||||
@ -24,9 +25,9 @@ jobs:
 | 
			
		||||
          sudo chmod 600 ../private.key
 | 
			
		||||
 | 
			
		||||
      - name: Cleanup PR deployment
 | 
			
		||||
        id: cleanup
 | 
			
		||||
        run: |
 | 
			
		||||
          ssh -i ../private.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} << 'ENDSSH'
 | 
			
		||||
            # Check if directory exists before attempting cleanup
 | 
			
		||||
          CLEANUP_STATUS=$(ssh -i ../private.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} << 'ENDSSH'
 | 
			
		||||
            if [ -d "/stirling/PR-${{ github.event.pull_request.number }}" ]; then
 | 
			
		||||
              echo "Found PR directory, proceeding with cleanup..."
 | 
			
		||||
              
 | 
			
		||||
@ -43,13 +44,22 @@ jobs:
 | 
			
		||||
              # Remove the Docker image
 | 
			
		||||
              docker rmi --no-prune ${{ secrets.DOCKER_HUB_USERNAME }}/test:pr-${{ github.event.pull_request.number }} || true
 | 
			
		||||
              
 | 
			
		||||
              echo "Cleanup completed successfully"
 | 
			
		||||
              echo "PERFORMED_CLEANUP"
 | 
			
		||||
            else
 | 
			
		||||
              echo "PR directory not found, nothing to clean up"
 | 
			
		||||
              echo "NO_CLEANUP_NEEDED"
 | 
			
		||||
            fi
 | 
			
		||||
          ENDSSH
 | 
			
		||||
          )
 | 
			
		||||
          
 | 
			
		||||
          if [[ $CLEANUP_STATUS == *"PERFORMED_CLEANUP"* ]]; then
 | 
			
		||||
            echo "cleanup_performed=true" >> $GITHUB_OUTPUT
 | 
			
		||||
          else
 | 
			
		||||
            echo "cleanup_performed=false" >> $GITHUB_OUTPUT
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Post cleanup notice to PR
 | 
			
		||||
        if: steps.cleanup.outputs.cleanup_performed == 'true'
 | 
			
		||||
        uses: actions/github-script@v7
 | 
			
		||||
        with:
 | 
			
		||||
          script: |
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user