Update .gitea/workflows/renovate.yaml #36
					 1 changed files with 100 additions and 31 deletions
				
			
		| 
						 | 
				
			
			@ -8,40 +8,109 @@ on:
 | 
			
		|||
 | 
			
		||||
jobs:
 | 
			
		||||
  renovate:
 | 
			
		||||
    name: Renovate with Batching
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    # Pin to a specific Renovate version for stability (check ghcr.io for latest)
 | 
			
		||||
    # Example: ghcr.io/renovatebot/renovate:37.250.0
 | 
			
		||||
    container: ghcr.io/renovatebot/renovate:39.219.2 # Pinned version
 | 
			
		||||
    
 | 
			
		||||
    steps:
 | 
			
		||||
      # Checkout the repository containing config.js
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
      
 | 
			
		||||
      # Cache Renovate's dependency cache directory between runs
 | 
			
		||||
      - name: Cache Renovate dependencies
 | 
			
		||||
        uses: actions/cache@v4
 | 
			
		||||
        with:
 | 
			
		||||
          path: /tmp/renovate-cache # Renovate's default cache directory
 | 
			
		||||
          # Key based on OS, config file hash, and run ID (ensures save)
 | 
			
		||||
          key: ${{ runner.os }}-renovate-${{ hashFiles('config.js') }}-${{ github.run_id }}
 | 
			
		||||
          # Fallback keys for restoring from previous runs
 | 
			
		||||
          restore-keys: |
 | 
			
		||||
            ${{ runner.os }}-renovate-${{ hashFiles('config.js') }}-
 | 
			
		||||
            ${{ runner.os }}-renovate-
 | 
			
		||||
      - name: Install Renovate and Dependencies
 | 
			
		||||
        run: |
 | 
			
		||||
          npm install -g renovate
 | 
			
		||||
          if ! command -v jq &> /dev/null; then
 | 
			
		||||
            sudo apt-get update && sudo apt-get install -y jq
 | 
			
		||||
          fi
 | 
			
		||||
      
 | 
			
		||||
      # Run Renovate using the configuration file
 | 
			
		||||
      - name: Run Renovate
 | 
			
		||||
        run: renovate
 | 
			
		||||
      - name: Debug Environment
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "Node version: $(node --version)"
 | 
			
		||||
          echo "NPM version: $(npm --version)"
 | 
			
		||||
          echo "JQ version: $(jq --version)"
 | 
			
		||||
          echo "Current directory: $(pwd)"
 | 
			
		||||
          ls -la
 | 
			
		||||
          echo "Config file contents:"
 | 
			
		||||
          if [ -f "config.js" ]; then
 | 
			
		||||
            cat config.js
 | 
			
		||||
          else
 | 
			
		||||
            echo "Config file not found!"
 | 
			
		||||
          fi
 | 
			
		||||
      
 | 
			
		||||
      - name: Discover Repositories
 | 
			
		||||
        id: discover
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "Starting repository discovery..."
 | 
			
		||||
          renovate --write-discovered-repos=renovate-repos.json
 | 
			
		||||
          
 | 
			
		||||
          if [ -f renovate-repos.json ]; then
 | 
			
		||||
            echo "Repository discovery results:"
 | 
			
		||||
            cat renovate-repos.json
 | 
			
		||||
            
 | 
			
		||||
            if jq . renovate-repos.json > /dev/null 2>&1; then
 | 
			
		||||
              echo "Valid JSON file found"
 | 
			
		||||
              REPO_COUNT=$(jq '. | length' renovate-repos.json)
 | 
			
		||||
              echo "Found $REPO_COUNT repositories"
 | 
			
		||||
              
 | 
			
		||||
              if [ "$REPO_COUNT" -gt 0 ]; then
 | 
			
		||||
                # Create list of all repos for processing
 | 
			
		||||
                ALL_REPOS=$(jq -r '. | join(",")' renovate-repos.json)
 | 
			
		||||
                echo "all_repos=$ALL_REPOS" >> $GITHUB_OUTPUT
 | 
			
		||||
                echo "All repositories: $ALL_REPOS"
 | 
			
		||||
              else
 | 
			
		||||
                echo "No repositories found in autodiscovery"
 | 
			
		||||
              fi
 | 
			
		||||
            else
 | 
			
		||||
              echo "Invalid JSON in renovate-repos.json"
 | 
			
		||||
              cat renovate-repos.json
 | 
			
		||||
            fi
 | 
			
		||||
          else
 | 
			
		||||
            echo "No repository discovery results file created"
 | 
			
		||||
          fi
 | 
			
		||||
        env:
 | 
			
		||||
          # --- Core Configuration ---
 | 
			
		||||
          RENOVATE_CONFIG_FILE: "config.js" # Path to your config file
 | 
			
		||||
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }} # Token for Gitea
 | 
			
		||||
          GITHUB_COM_TOKEN: ${{ secrets.GH_TOKEN }} # Only needed if Renovate MUST access github.com (e.g., for release notes). Remove if not needed.
 | 
			
		||||
          RENOVATE_CONFIG_FILE: "config.js"
 | 
			
		||||
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
 | 
			
		||||
          GITHUB_COM_TOKEN: ${{ secrets.GH_TOKEN }}
 | 
			
		||||
          LOG_LEVEL: "debug" # Set to debug for more information
 | 
			
		||||
          RENOVATE_AUTODISCOVER: "true"
 | 
			
		||||
      
 | 
			
		||||
          # --- Performance & Logging ---
 | 
			
		||||
          # Use 'info' for normal runs, 'debug' only when troubleshooting
 | 
			
		||||
      - name: Process All Repositories
 | 
			
		||||
        if: steps.discover.outputs.all_repos != ''
 | 
			
		||||
        run: |
 | 
			
		||||
          ALL_REPOS="${{ steps.discover.outputs.all_repos }}"
 | 
			
		||||
          echo "Processing all repositories: $ALL_REPOS"
 | 
			
		||||
          
 | 
			
		||||
          # Process in batches of 5
 | 
			
		||||
          IFS=',' read -ra REPO_ARRAY <<< "$ALL_REPOS"
 | 
			
		||||
          
 | 
			
		||||
          TOTAL=${#REPO_ARRAY[@]}
 | 
			
		||||
          echo "Total repositories to process: $TOTAL"
 | 
			
		||||
          
 | 
			
		||||
          for ((i=0; i<TOTAL; i+=5)); do
 | 
			
		||||
            BATCH=""
 | 
			
		||||
            for ((j=i; j<i+5 && j<TOTAL; j++)); do
 | 
			
		||||
              if [ -n "$BATCH" ]; then
 | 
			
		||||
                BATCH="$BATCH,${REPO_ARRAY[$j]}"
 | 
			
		||||
              else
 | 
			
		||||
                BATCH="${REPO_ARRAY[$j]}"
 | 
			
		||||
              fi
 | 
			
		||||
            done
 | 
			
		||||
            
 | 
			
		||||
            echo "Processing batch $((i/5+1)): $BATCH"
 | 
			
		||||
            renovate $BATCH
 | 
			
		||||
          done
 | 
			
		||||
        env:
 | 
			
		||||
          RENOVATE_CONFIG_FILE: "config.js"
 | 
			
		||||
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
 | 
			
		||||
          GITHUB_COM_TOKEN: ${{ secrets.GH_TOKEN }}
 | 
			
		||||
          LOG_LEVEL: "info"
 | 
			
		||||
          # Explicitly tell Renovate where the cache is (matches actions/cache path)
 | 
			
		||||
          RENOVATE_CACHE_DIR: /tmp/renovate-cache
 | 
			
		||||
      
 | 
			
		||||
      - name: Run Default Renovate
 | 
			
		||||
        if: steps.discover.outputs.all_repos == ''
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "No repositories discovered, running default renovate"
 | 
			
		||||
          renovate
 | 
			
		||||
        env:
 | 
			
		||||
          RENOVATE_CONFIG_FILE: "config.js"
 | 
			
		||||
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
 | 
			
		||||
          GITHUB_COM_TOKEN: ${{ secrets.GH_TOKEN }}
 | 
			
		||||
          LOG_LEVEL: "info"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue