From f1e75f4776188844dc11e71743359e6360fe615b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 8 Jan 2025 15:26:45 +0100 Subject: [PATCH] workflow --- .github/workflows/watch-repos.yml | 33 +++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/watch-repos.yml b/.github/workflows/watch-repos.yml index 56131a6..d7b98df 100644 --- a/.github/workflows/watch-repos.yml +++ b/.github/workflows/watch-repos.yml @@ -142,14 +142,43 @@ jobs: chmod +x api_helper.sh - name: Full Repository Ingestion if: >- - steps.config.outputs.config_exists == 'true' && github.event_name == 'workflow_dispatch' && github.event.inputs.full_ingest == 'true' + steps.config.outputs.config_exists == 'true' && github.event_name == + 'workflow_dispatch' && github.event.inputs.full_ingest == 'true' run: | source ./api_helper.sh echo "Starting full repository ingestion..." echo "DEBUG: Making initial API call..." - # Make the API call - response is already validated by call_api + # First construct the REQUEST_BODY using jq + REQUEST_BODY=$(jq -n \ + --arg repo "${{ github.repository }}" \ + --arg branch "${{ github.ref_name }}" \ + --arg event_type "${{ github.event_name }}" \ + --arg commit_sha "${{ github.sha }}" \ + --argjson config "$CONFIG" \ + '{ + "repo": $repo, + "branch": $branch, + "metadata": { + "repository": $repo, + "branch": $branch, + "event_type": $event_type, + "commit_sha": $commit_sha, + "process_timestamp": (now | strftime("%Y-%m-%dT%H:%M:%SZ")), + "config": $config + }, + "maxFileSize": ($config.max_file_size // 100000), + "maxTokens": ($config.max_tokens // 50000), + "forceReplace": true + }' + ) + + echo "DEBUG: Request body:" + echo "$REQUEST_BODY" | jq '.' + + # Make the API call + echo "Making API call to ingest-repo..." response=$(call_api "${{ steps.config.outputs.osiris_url }}/api/ingest-repo" "$REQUEST_BODY") api_status=$?