Skip to content

Indexer Sync Automation #207

Indexer Sync Automation

Indexer Sync Automation #207

Workflow file for this run

---
name: Indexer Sync Automation
on:
schedule:
# Run 3 times daily every 8 hours
- cron: '0 */8 * * *'
workflow_dispatch:
inputs:
force_sync:
description: 'Force sync even if up to date'
required: false
default: false
type: boolean
mode:
description: 'Execution mode'
required: false
default: 'normal'
type: choice
options:
- normal
- development
debug_mode:
description: 'Enable debug logging (DEBUG=true)'
required: false
default: false
type: boolean
verbose_mode:
description: 'Enable verbose logging (VERBOSE=true)'
required: false
default: false
type: boolean
target_branch:
description: 'Target branch for sync (automated-indexer-sync/master)'
required: false
default: 'automated-indexer-sync'
type: choice
options:
- automated-indexer-sync
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync-indexers:
name: Sync Indexers from Jackett
runs-on: ubuntu-latest
if: github.repository == 'Prowlarr/Indexers'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 50
fetch-tags: false
- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pip
.venv
key: python-deps-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
python-deps-${{ runner.os }}-
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Create virtual environment and install dependencies
run: |
if [ ! -d ".venv" ]; then
python3 -m venv .venv
fi
# shellcheck disable=SC1091
source .venv/bin/activate
# Ensure pip is installed and upgraded
python -m ensurepip --upgrade || true
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global fetch.prune true
git config advice.mergeConflict false
# Add Jackett remote if it doesn't exist
if ! git remote get-url z_Jackett >/dev/null 2>&1; then
git remote add z_Jackett https://github.com/Jackett/Jackett.git
fi
git config --global remote.z_Jackett.tagOpt --no-tags
- name: Fetch repositories
run: |
echo "πŸ”„ Fetching Jackett repository..."
git fetch z_Jackett master --depth=50
echo "βœ… Jackett repository fetched successfully"
echo "πŸ”„ Fetching prowlarr/indexers repository..."
git fetch origin master --depth=50
echo "βœ… prowlarr/indexers repository fetched successfully"
- name: Run indexer sync
run: |
# Activate virtual environment if it exists
if [ -d ".venv" ]; then
# shellcheck disable=SC1091
source .venv/bin/activate
fi
# Run the sync script with -z mode, automation mode, and push enabled
TARGET_BRANCH="${{ github.event.inputs.target_branch || 'automated-indexer-sync' }}"
MODE="${{ github.event.inputs.mode || 'normal' }}"
# Build flags based on inputs
FLAGS="-z -a -p -b $TARGET_BRANCH -o origin -m $MODE"
if [ "${{ github.event.inputs.debug_mode }}" = "true" ]; then
FLAGS="$FLAGS -d"
fi
if [ "${{ github.event.inputs.verbose_mode }}" = "true" ]; then
FLAGS="$FLAGS -v"
fi
if [ "${{ github.event.inputs.force_sync }}" = "true" ]; then
FLAGS="$FLAGS -f"
fi
echo "Running: ./scripts/indexer-sync-v2.sh $FLAGS"
./scripts/indexer-sync-v2.sh $FLAGS
- name: Summary
run: |
echo "βœ… Indexer sync workflow completed"
echo "πŸ“ Changes pushed to automated-indexer-sync branch"