| #!/bin/bash |
|
|
| |
| |
|
|
| echo "π€ Dependabot PR Review Workflow" |
| echo "==================================" |
|
|
| |
| EANAME_REPO="EAName/algorithmic_trading" |
| PARALLEL_REPO="ParallelLLC/algorithmic_trading" |
|
|
| |
| RED='\033[0;31m' |
| GREEN='\033[0;32m' |
| YELLOW='\033[1;33m' |
| BLUE='\033[0;34m' |
| NC='\033[0m' |
|
|
| |
| check_pr_status() { |
| local repo=$1 |
| local pr_number=$2 |
| local pr_title=$3 |
| |
| echo -e "\n${BLUE}π Reviewing PR #$pr_number: $pr_title${NC}" |
| echo "Repository: $repo" |
| |
| |
| echo -e "${YELLOW}π Opening PR in browser...${NC}" |
| open "https://github.com/$repo/pull/$pr_number" |
| |
| |
| echo -e "${YELLOW}β³ Review the PR in your browser, then press Enter to continue...${NC}" |
| read -r |
| |
| |
| echo -e "${GREEN}β
Decision for PR #$pr_number:${NC}" |
| echo "1. Approve" |
| echo "2. Request changes" |
| echo "3. Comment only" |
| echo "4. Skip for now" |
| |
| read -p "Enter your choice (1-4): " choice |
| |
| case $choice in |
| 1) |
| echo -e "${GREEN}β
Approved PR #$pr_number${NC}" |
| echo "$repo PR #$pr_number: APPROVED - $pr_title" >> review_log.txt |
| ;; |
| 2) |
| echo -e "${RED}β Requested changes for PR #$pr_number${NC}" |
| echo "$repo PR #$pr_number: CHANGES_REQUESTED - $pr_title" >> review_log.txt |
| ;; |
| 3) |
| echo -e "${YELLOW}π¬ Commented on PR #$pr_number${NC}" |
| echo "$repo PR #$pr_number: COMMENTED - $pr_title" >> review_log.txt |
| ;; |
| 4) |
| echo -e "${YELLOW}βοΈ Skipped PR #$pr_number${NC}" |
| echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt |
| ;; |
| *) |
| echo -e "${RED}β Invalid choice, skipping...${NC}" |
| echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt |
| ;; |
| esac |
| } |
|
|
| |
| run_local_tests() { |
| echo -e "\n${BLUE}π§ͺ Running local tests...${NC}" |
| |
| |
| if [ ! -f "requirements.txt" ]; then |
| echo -e "${RED}β Not in algorithmic_trading directory${NC}" |
| return 1 |
| fi |
| |
| |
| echo "Running pytest..." |
| python -m pytest tests/ -v --tb=short |
| if [ $? -eq 0 ]; then |
| echo -e "${GREEN}β
Tests passed${NC}" |
| else |
| echo -e "${RED}β Tests failed${NC}" |
| return 1 |
| fi |
| |
| |
| echo "Checking code formatting..." |
| python -m black --check . |
| if [ $? -eq 0 ]; then |
| echo -e "${GREEN}β
Code formatting OK${NC}" |
| else |
| echo -e "${YELLOW}β οΈ Code formatting issues found${NC}" |
| fi |
| |
| |
| echo "Checking for security issues..." |
| if command -v safety &> /dev/null; then |
| safety check |
| else |
| echo -e "${YELLOW}β οΈ Safety not installed, skipping security check${NC}" |
| fi |
| } |
|
|
| |
| check_docker_build() { |
| echo -e "\n${BLUE}π³ Testing Docker build...${NC}" |
| |
| |
| docker build -t test-algorithmic-trading . |
| if [ $? -eq 0 ]; then |
| echo -e "${GREEN}β
Docker build successful${NC}" |
| |
| |
| docker run --rm test-algorithmic-trading python -c "print('Docker test passed')" |
| if [ $? -eq 0 ]; then |
| echo -e "${GREEN}β
Docker image test passed${NC}" |
| else |
| echo -e "${RED}β Docker image test failed${NC}" |
| fi |
| |
| |
| docker rmi test-algorithmic-trading |
| else |
| echo -e "${RED}β Docker build failed${NC}" |
| return 1 |
| fi |
| } |
|
|
| |
| main() { |
| echo -e "${GREEN}π Starting Dependabot PR Review Workflow${NC}" |
| |
| |
| echo "# Dependabot PR Review Log - $(date)" > review_log.txt |
| echo "" >> review_log.txt |
| |
| |
| run_local_tests |
| |
| |
| check_docker_build |
| |
| echo -e "\n${BLUE}π Reviewing EAName Repository PRs${NC}" |
| echo "==================================" |
| |
| |
| check_pr_status "$EANAME_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim" |
| check_pr_status "$EANAME_REPO" "5" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7" |
| check_pr_status "$EANAME_REPO" "4" "github-actions(deps): bump peaceiris/actions-gh-pages from 3 to 4" |
| check_pr_status "$EANAME_REPO" "3" "github-actions(deps): bump actions/upload-artifact from 3 to 4" |
| check_pr_status "$EANAME_REPO" "2" "github-actions(deps): bump docker/login-action from 2 to 3" |
| check_pr_status "$EANAME_REPO" "1" "github-actions(deps): bump github/codeql-action from 2 to 3" |
| |
| echo -e "\n${BLUE}π Reviewing ParallelLLC Repository PRs${NC}" |
| echo "==================================" |
| |
| |
| check_pr_status "$PARALLEL_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim" |
| check_pr_status "$PARALLEL_REPO" "5" "github-actions(deps): bump actions/setup-python from 4 to 5" |
| check_pr_status "$PARALLEL_REPO" "4" "github-actions(deps): bump docker/login-action from 2 to 3" |
| check_pr_status "$PARALLEL_REPO" "3" "github-actions(deps): bump docker/metadata-action from 4 to 5" |
| check_pr_status "$PARALLEL_REPO" "2" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7" |
| check_pr_status "$PARALLEL_REPO" "1" "github-actions(deps): bump docker/build-push-action from 4 to 6" |
| |
| |
| echo -e "\n${GREEN}β
Review workflow completed!${NC}" |
| echo -e "${BLUE}π Review log saved to: review_log.txt${NC}" |
| echo -e "\n${YELLOW}π Summary:${NC}" |
| cat review_log.txt |
| } |
|
|
| |
| main |