Skip to content

Commit 8c433c4

Browse files
authored
Update test-doc-generator.yml
1 parent c4ea7d8 commit 8c433c4

File tree

1 file changed

+53
-26
lines changed

1 file changed

+53
-26
lines changed

.github/workflows/test-doc-generator.yml

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ jobs:
1313
with:
1414
token: ${{ secrets.test_REPO_ACCESS_TOKEN }}
1515

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
2018

2119
- name: Ensure scripts directory exists
2220
run: |
@@ -60,53 +58,82 @@ jobs:
6058
if: env.changes_found != 'true'
6159
run: exit 0
6260

63-
- name: Process files from test repo
61+
- name: Process files with OpenAI
6462
run: |
6563
mkdir -p generated_docs
6664
HASHES_JSON=$(cat scripts/file_hashes.json)
6765
PROCESSED_COUNT=0
66+
6867
while IFS= read -r FILE_NAME; do
68+
echo "⏳ Processing $FILE_NAME"
6969
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
7171
7272
FILE_SHA=$(grep "$FILE_NAME" latest_files_with_sha.txt | cut -f2)
7373
HASHES_JSON=$(echo "$HASHES_JSON" | jq --arg file "$FILE_NAME" --arg sha "$FILE_SHA" '.[$file] = $sha')
7474
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.")
7677
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 \
8493
-H "Authorization: Bearer ${{ secrets.test_OPENAI_API_KEY }}" \
8594
-H "Content-Type: application/json" \
8695
-d "$PAYLOAD")
87-
echo "$RESPONSE" | jq -r '.choices[0].text' > "extracted_info.md"
8896
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.")
90103
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 \
98119
-H "Authorization: Bearer ${{ secrets.test_OPENAI_API_KEY }}" \
99120
-H "Content-Type: application/json" \
100121
-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
102126
103127
INTEGRATION=$(echo "$FILE_NAME" | sed 's/_uqi_config\.json//' | tr '[:upper:]' '[:lower:]')
104128
FINAL_PATH="website/docs/connect-data/reference/${INTEGRATION}.md"
129+
105130
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+
108134
echo "$FILE_NAME" >> scripts/processed_files.txt
109135
PROCESSED_COUNT=$((PROCESSED_COUNT + 1))
136+
echo "✅ Finished $FILE_NAME"
110137
done < files_to_process.txt
111138
112139
echo "$HASHES_JSON" > scripts/file_hashes.json

0 commit comments

Comments
 (0)