|
13 | 13 | with: |
14 | 14 | token: ${{ secrets.test_REPO_ACCESS_TOKEN }} |
15 | 15 |
|
16 | | - - name: Create exclusion list for test |
17 | | - run: | |
18 | | - cat > saas_exclusions.txt << EOF |
19 | | - EOF |
| 16 | + - name: Create exclusion list |
| 17 | + run: echo > saas_exclusions.txt |
20 | 18 |
|
21 | 19 | - name: Ensure scripts directory exists |
22 | 20 | run: | |
@@ -60,53 +58,82 @@ jobs: |
60 | 58 | if: env.changes_found != 'true' |
61 | 59 | run: exit 0 |
62 | 60 |
|
63 | | - - name: Process files from test repo |
| 61 | + - name: Process files with OpenAI |
64 | 62 | run: | |
65 | 63 | mkdir -p generated_docs |
66 | 64 | HASHES_JSON=$(cat scripts/file_hashes.json) |
67 | 65 | PROCESSED_COUNT=0 |
| 66 | +
|
68 | 67 | while IFS= read -r FILE_NAME; do |
| 68 | + echo "⏳ Processing $FILE_NAME" |
69 | 69 | FILE_URL="https://raw.githubusercontent.com/harshilp24/integration-resources-test/main/Generic%20UQI%20Creation/uqi_configs/$FILE_NAME" |
70 | | - curl -sSL --max-time 30 "$FILE_URL" -o "input_file.json" |
| 70 | + curl -sSL --max-time 30 "$FILE_URL" -o input_file.json |
71 | 71 |
|
72 | 72 | FILE_SHA=$(grep "$FILE_NAME" latest_files_with_sha.txt | cut -f2) |
73 | 73 | HASHES_JSON=$(echo "$HASHES_JSON" | jq --arg file "$FILE_NAME" --arg sha "$FILE_SHA" '.[$file] = $sha') |
74 | 74 |
|
75 | | - SYSTEM_PROMPT=$(cat .github/prompts/extract_prompt.txt) |
| 75 | + # Prompt 1: Extract Info |
| 76 | + SYSTEM_PROMPT=$(cat .github/prompts/extract_prompt.txt || echo "Extract important integration details.") |
76 | 77 | USER_CONTENT=$(cat input_file.json) |
77 | | - PAYLOAD=$(jq -n --arg prompt "System: $SYSTEM_PROMPT\n\nUser: $USER_CONTENT" '{ |
78 | | - model: "gpt-4.1", |
79 | | - prompt: $prompt, |
80 | | - max_tokens: 2000, |
81 | | - temperature: 0 |
82 | | - }') |
83 | | - RESPONSE=$(curl -s https://api.openai.com/v1/completions \ |
| 78 | +
|
| 79 | + PAYLOAD=$(jq -n \ |
| 80 | + --arg system "$SYSTEM_PROMPT" \ |
| 81 | + --arg user "$USER_CONTENT" \ |
| 82 | + '{ |
| 83 | + model: "gpt-4-1106-preview", |
| 84 | + messages: [ |
| 85 | + {"role": "system", "content": $system}, |
| 86 | + {"role": "user", "content": $user} |
| 87 | + ], |
| 88 | + max_tokens: 2000, |
| 89 | + temperature: 0 |
| 90 | + }') |
| 91 | +
|
| 92 | + RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \ |
84 | 93 | -H "Authorization: Bearer ${{ secrets.test_OPENAI_API_KEY }}" \ |
85 | 94 | -H "Content-Type: application/json" \ |
86 | 95 | -d "$PAYLOAD") |
87 | | - echo "$RESPONSE" | jq -r '.choices[0].text' > "extracted_info.md" |
88 | 96 |
|
89 | | - SYSTEM_PROMPT=$(cat .github/prompts/generate_prompt.txt) |
| 97 | + echo "$RESPONSE" | jq '.' |
| 98 | +
|
| 99 | + echo "$RESPONSE" | jq -r '.choices[0].message.content' > extracted_info.md |
| 100 | +
|
| 101 | + # Prompt 2: Generate Markdown |
| 102 | + SYSTEM_PROMPT=$(cat .github/prompts/generate_prompt.txt || echo "Generate reference documentation in markdown.") |
90 | 103 | EXTRACTED_CONTENT=$(cat extracted_info.md) |
91 | | - PAYLOAD=$(jq -n --arg prompt "System: $SYSTEM_PROMPT\n\nUser: $EXTRACTED_CONTENT" '{ |
92 | | - model: "gpt-4.1", |
93 | | - prompt: $prompt, |
94 | | - max_tokens: 4000, |
95 | | - temperature: 0.3 |
96 | | - }') |
97 | | - RESPONSE=$(curl -s https://api.openai.com/v1/completions \ |
| 104 | +
|
| 105 | + PAYLOAD=$(jq -n \ |
| 106 | + --arg system "$SYSTEM_PROMPT" \ |
| 107 | + --arg user "$EXTRACTED_CONTENT" \ |
| 108 | + '{ |
| 109 | + model: "gpt-4-1106-preview", |
| 110 | + messages: [ |
| 111 | + {"role": "system", "content": $system}, |
| 112 | + {"role": "user", "content": $user} |
| 113 | + ], |
| 114 | + max_tokens: 4000, |
| 115 | + temperature: 0.3 |
| 116 | + }') |
| 117 | +
|
| 118 | + RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \ |
98 | 119 | -H "Authorization: Bearer ${{ secrets.test_OPENAI_API_KEY }}" \ |
99 | 120 | -H "Content-Type: application/json" \ |
100 | 121 | -d "$PAYLOAD") |
101 | | - echo "$RESPONSE" | jq -r '.choices[0].text' > "generated_doc.md" |
| 122 | +
|
| 123 | + echo "$RESPONSE" | jq '.' |
| 124 | +
|
| 125 | + echo "$RESPONSE" | jq -r '.choices[0].message.content' > generated_doc.md |
102 | 126 |
|
103 | 127 | INTEGRATION=$(echo "$FILE_NAME" | sed 's/_uqi_config\.json//' | tr '[:upper:]' '[:lower:]') |
104 | 128 | FINAL_PATH="website/docs/connect-data/reference/${INTEGRATION}.md" |
| 129 | +
|
105 | 130 | mkdir -p "$(dirname "$FINAL_PATH")" |
106 | | - cp "generated_doc.md" "$FINAL_PATH" |
107 | | - cp "generated_doc.md" "generated_docs/${INTEGRATION}.md" |
| 131 | + cp generated_doc.md "$FINAL_PATH" |
| 132 | + cp generated_doc.md "generated_docs/${INTEGRATION}.md" |
| 133 | +
|
108 | 134 | echo "$FILE_NAME" >> scripts/processed_files.txt |
109 | 135 | PROCESSED_COUNT=$((PROCESSED_COUNT + 1)) |
| 136 | + echo "✅ Finished $FILE_NAME" |
110 | 137 | done < files_to_process.txt |
111 | 138 |
|
112 | 139 | echo "$HASHES_JSON" > scripts/file_hashes.json |
|
0 commit comments