Fixed create_index.py, added venv to reindex action
This commit is contained in:
@@ -14,23 +14,53 @@ jobs:
|
|||||||
# This condition ensures the job only runs if the pull request was actually merged.
|
# 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'
|
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.
|
# 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: Windows
|
runs-on: Windows
|
||||||
|
|
||||||
|
# Set a default shell for all run steps in the job.
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Step 1: Check out the repository's code
|
# Step 1: Check out the repository's code
|
||||||
# This downloads the latest version of your 'main' branch into the runner's working directory.
|
# This downloads the latest version of your 'main' branch into the runner's working directory.
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Step 2: Run the indexing script
|
# Step 2: Set up a specific Python version
|
||||||
# This executes your 'create_index.py' script using the Python environment on your server.
|
# This ensures a consistent Python version is used for the venv.
|
||||||
# It assumes Python and all dependencies from requirements.txt are already installed on the server.
|
- name: Set up Python 3.11
|
||||||
|
id: setup-python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
# Step 3: Create and activate a virtual environment
|
||||||
|
# This creates a '.venv' directory in your project folder if it doesn't exist,
|
||||||
|
# and then activates it for subsequent steps.
|
||||||
|
- name: Create and activate virtual environment
|
||||||
|
run: |
|
||||||
|
if [ ! -d ".venv" ]; then
|
||||||
|
python -m venv .venv
|
||||||
|
fi
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
# Step 4: Install or update dependencies
|
||||||
|
# This uses the pip from the virtual environment to install all required libraries.
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
source .venv/bin/activate
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Step 5: Run the indexing script within the virtual environment
|
||||||
|
# It executes your 'create_index.py' script using the Python from the venv.
|
||||||
# The GITHUB_TOKEN is still passed securely to the script.
|
# The GITHUB_TOKEN is still passed securely to the script.
|
||||||
- name: Run indexing script
|
- name: Run indexing script
|
||||||
run: python create_index.py
|
run: |
|
||||||
|
source .venv/bin/activate
|
||||||
|
python create_index.py
|
||||||
env:
|
env:
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ from tools.github_tool import GitHubTool
|
|||||||
EMBEDDING_MODEL_PATH = """C:\Models\embeddings\Qwen3-Embedding-0.6B"""
|
EMBEDDING_MODEL_PATH = """C:\Models\embeddings\Qwen3-Embedding-0.6B"""
|
||||||
|
|
||||||
# Path to store the local vector database
|
# Path to store the local vector database
|
||||||
CHROMA_DB_PATH = "C:\Models\embeddings\embedding_result\chroma_db"
|
CHROMA_DB_PATH = """C:\Models\embeddings\embedding_result\chroma_db"""
|
||||||
# Name of the collection within the database
|
# Name of the collection within the database
|
||||||
CHROMA_COLLECTION_NAME = "github_repo"
|
CHROMA_COLLECTION_NAME = "github_repo"
|
||||||
# Files with these extensions will be indexed. Add any other text-based files you need.
|
# Files with these extensions will be indexed. Add any other text-based files you need.
|
||||||
|
|||||||
Reference in New Issue
Block a user