Team Ai
Modelpublic

ParallelLLC/algorithmic_trading

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
27likes32downloads
review_dependabot_prs.sh177 linesDownload Raw Back to scripts
1#!/bin/bash2 3# Dependabot PR Review Workflow Script4# This script helps review all Dependabot PRs efficiently5 6echo "๐Ÿค– Dependabot PR Review Workflow"7echo "=================================="8 9# Configuration10EANAME_REPO="EAName/algorithmic_trading"11PARALLEL_REPO="ParallelLLC/algorithmic_trading"12 13# Colors for output14RED='\033[0;31m'15GREEN='\033[0;32m'16YELLOW='\033[1;33m'17BLUE='\033[0;34m'18NC='\033[0m' # No Color19 20# Function to check PR status21check_pr_status() {22    local repo=$123    local pr_number=$224    local pr_title=$325    26    echo -e "\n${BLUE}๐Ÿ“‹ Reviewing PR #$pr_number: $pr_title${NC}"27    echo "Repository: $repo"28    29    # Open PR in browser30    echo -e "${YELLOW}๐Ÿ”— Opening PR in browser...${NC}"31    open "https://github.com/$repo/pull/$pr_number"32    33    # Wait for user to review34    echo -e "${YELLOW}โณ Review the PR in your browser, then press Enter to continue...${NC}"35    read -r36    37    # Ask for decision38    echo -e "${GREEN}โœ… Decision for PR #$pr_number:${NC}"39    echo "1. Approve"40    echo "2. Request changes"41    echo "3. Comment only"42    echo "4. Skip for now"43    44    read -p "Enter your choice (1-4): " choice45    46    case $choice in47        1)48            echo -e "${GREEN}โœ… Approved PR #$pr_number${NC}"49            echo "$repo PR #$pr_number: APPROVED - $pr_title" >> review_log.txt50            ;;51        2)52            echo -e "${RED}โŒ Requested changes for PR #$pr_number${NC}"53            echo "$repo PR #$pr_number: CHANGES_REQUESTED - $pr_title" >> review_log.txt54            ;;55        3)56            echo -e "${YELLOW}๐Ÿ’ฌ Commented on PR #$pr_number${NC}"57            echo "$repo PR #$pr_number: COMMENTED - $pr_title" >> review_log.txt58            ;;59        4)60            echo -e "${YELLOW}โญ๏ธ Skipped PR #$pr_number${NC}"61            echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt62            ;;63        *)64            echo -e "${RED}โŒ Invalid choice, skipping...${NC}"65            echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt66            ;;67    esac68}69 70# Function to run local tests71run_local_tests() {72    echo -e "\n${BLUE}๐Ÿงช Running local tests...${NC}"73    74    # Check if we're in the right directory75    if [ ! -f "requirements.txt" ]; then76        echo -e "${RED}โŒ Not in algorithmic_trading directory${NC}"77        return 178    fi79    80    # Run tests81    echo "Running pytest..."82    python -m pytest tests/ -v --tb=short83    if [ $? -eq 0 ]; then84        echo -e "${GREEN}โœ… Tests passed${NC}"85    else86        echo -e "${RED}โŒ Tests failed${NC}"87        return 188    fi89    90    # Check code formatting91    echo "Checking code formatting..."92    python -m black --check .93    if [ $? -eq 0 ]; then94        echo -e "${GREEN}โœ… Code formatting OK${NC}"95    else96        echo -e "${YELLOW}โš ๏ธ Code formatting issues found${NC}"97    fi98    99    # Check for security issues100    echo "Checking for security issues..."101    if command -v safety &> /dev/null; then102        safety check103    else104        echo -e "${YELLOW}โš ๏ธ Safety not installed, skipping security check${NC}"105    fi106}107 108# Function to check Docker build109check_docker_build() {110    echo -e "\n${BLUE}๐Ÿณ Testing Docker build...${NC}"111    112    # Build Docker image113    docker build -t test-algorithmic-trading .114    if [ $? -eq 0 ]; then115        echo -e "${GREEN}โœ… Docker build successful${NC}"116        117        # Test Docker image118        docker run --rm test-algorithmic-trading python -c "print('Docker test passed')"119        if [ $? -eq 0 ]; then120            echo -e "${GREEN}โœ… Docker image test passed${NC}"121        else122            echo -e "${RED}โŒ Docker image test failed${NC}"123        fi124        125        # Clean up126        docker rmi test-algorithmic-trading127    else128        echo -e "${RED}โŒ Docker build failed${NC}"129        return 1130    fi131}132 133# Main workflow134main() {135    echo -e "${GREEN}๐Ÿš€ Starting Dependabot PR Review Workflow${NC}"136    137    # Initialize review log138    echo "# Dependabot PR Review Log - $(date)" > review_log.txt139    echo "" >> review_log.txt140    141    # Run local tests first142    run_local_tests143    144    # Check Docker build145    check_docker_build146    147    echo -e "\n${BLUE}๐Ÿ“‹ Reviewing EAName Repository PRs${NC}"148    echo "=================================="149    150    # EAName Repository PRs151    check_pr_status "$EANAME_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim"152    check_pr_status "$EANAME_REPO" "5" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7"153    check_pr_status "$EANAME_REPO" "4" "github-actions(deps): bump peaceiris/actions-gh-pages from 3 to 4"154    check_pr_status "$EANAME_REPO" "3" "github-actions(deps): bump actions/upload-artifact from 3 to 4"155    check_pr_status "$EANAME_REPO" "2" "github-actions(deps): bump docker/login-action from 2 to 3"156    check_pr_status "$EANAME_REPO" "1" "github-actions(deps): bump github/codeql-action from 2 to 3"157    158    echo -e "\n${BLUE}๐Ÿ“‹ Reviewing ParallelLLC Repository PRs${NC}"159    echo "=================================="160    161    # ParallelLLC Repository PRs162    check_pr_status "$PARALLEL_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim"163    check_pr_status "$PARALLEL_REPO" "5" "github-actions(deps): bump actions/setup-python from 4 to 5"164    check_pr_status "$PARALLEL_REPO" "4" "github-actions(deps): bump docker/login-action from 2 to 3"165    check_pr_status "$PARALLEL_REPO" "3" "github-actions(deps): bump docker/metadata-action from 4 to 5"166    check_pr_status "$PARALLEL_REPO" "2" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7"167    check_pr_status "$PARALLEL_REPO" "1" "github-actions(deps): bump docker/build-push-action from 4 to 6"168    169    # Summary170    echo -e "\n${GREEN}โœ… Review workflow completed!${NC}"171    echo -e "${BLUE}๐Ÿ“ Review log saved to: review_log.txt${NC}"172    echo -e "\n${YELLOW}๐Ÿ“Š Summary:${NC}"173    cat review_log.txt174}175 176# Run the workflow177main