Files
cyclop/.github/workflows/reindex_on_merge.yml
T

43 lines
1.6 KiB
YAML

# .github/workflows/reindex_on_merge.yml
name: Re-index Repository on Merge (Self-Hosted)
on:
pull_request:
types: [closed]
branches:
- main
workflow_dispatch:
jobs:
reindex:
# This condition ensures the job only runs if the pull request was actually merged.
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
# *** KEY CHANGE ***
# This tells GitHub to run this job on one of your self-hosted runners.
# You can also add labels to target specific servers, e.g., [self-hosted, linux, x64, my-app]
runs-on: inference-server
steps:
# Step 1: Check out the repository's code
# This downloads the latest version of your 'main' branch into the runner's working directory.
- name: Checkout repository
uses: actions/checkout@v4
# Step 2: Run the indexing script
# This executes your 'create_index.py' script using the Python environment on your server.
# It assumes Python and all dependencies from requirements.txt are already installed on the server.
# The GITHUB_TOKEN is still passed securely to the script.
- name: Run indexing script
run: python create_index.py
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Optional: Specify the working directory if your bot lives in a subfolder
# working-directory: ./path/to/your/bot
# The "Upload database artifact" step is no longer needed, as the database
# is now being written directly to a persistent location on your server.