Skip to content

Commit e00dc27

Browse files
authored
Update sample-file-trigger.yml
1 parent 7345d13 commit e00dc27

File tree

1 file changed

+38
-47
lines changed

1 file changed

+38
-47
lines changed

.github/workflows/sample-file-trigger.yml

Lines changed: 38 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,75 +25,66 @@ jobs:
2525
exit 0
2626
fi
2727
28-
echo "Changed file detected: $CHANGED_FILE"
2928
echo "file_path=$CHANGED_FILE" >> $GITHUB_ENV
3029
3130
- name: Read file content
3231
id: read_file
3332
run: |
3433
echo "Reading file content..."
35-
CONTENT=$(cat ${{ env.file_path }} | jq -Rs .)
36-
echo "file_content=$CONTENT" >> $GITHUB_ENV
34+
FILE_CONTENT=$(cat ${{ env.file_path }} | jq -Rs .)
35+
echo "file_content=$FILE_CONTENT" >> $GITHUB_ENV
3736
3837
- name: Extract Commands and Properties (OpenAI Part 1)
3938
id: extract_details
4039
run: |
41-
echo "Sending JSON to OpenAI for extraction..."
40+
echo "Extracting commands and properties..."
4241
43-
EXTRACT_PROMPT=$(jq -n --arg json_content "${{ env.file_content }}" '{
44-
"model": "gpt-4o",
45-
"messages": [
46-
{
47-
"role": "system",
48-
"content": "You are a technical parser.\n\nObjective:\nGiven the provided JSON, extract all available Commands and their Properties clearly.\n\nOutput Format (Strict Plain Text)\n\nTotal Commands: X\n\nCommand: <Command Name>\nIdentifier: <Command Identifier>\n\nProperties:\n- <Property Name>: <Tooltip Text> (Example: <Placeholder Text>)\n\nImportant:\n- No Markdown formatting.\n- No headings (#, ##, etc.).\n- No <dd> tags.\n- No backticks.\n- Just clean, readable text."
49-
},
50-
{
51-
"role": "user",
52-
"content": $json_content
53-
}
54-
],
55-
"temperature": 0
56-
}')
57-
58-
echo "$EXTRACT_PROMPT" > extract_prompt.json
59-
60-
EXTRACTED=$(curl -s https://api.openai.com/v1/chat/completions \
42+
RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \
6143
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
6244
-H "Content-Type: application/json" \
63-
--data-binary @extract_prompt.json | jq -r '.choices[0].message.content')
64-
65-
echo "$EXTRACTED" > extracted_details.txt
66-
echo "Extraction completed."
45+
-d '{
46+
"model": "gpt-4o",
47+
"messages": [
48+
{
49+
"role": "system",
50+
"content": "You are a technical parser. Objective: Given the provided JSON, extract all available Commands and their Properties clearly. Output format: Total Commands: X, then for each Command: Identifier, Properties list. Important: No Markdown, no backticks, just clean plain text."
51+
},
52+
{
53+
"role": "user",
54+
"content": '"${{ env.file_content }}"'
55+
}
56+
],
57+
"temperature": 0
58+
}')
59+
60+
echo "$RESPONSE" | jq -r '.choices[0].message.content' > extracted_details.txt
6761
6862
- name: Generate Markdown Documentation (OpenAI Part 2)
6963
id: generate_doc
7064
run: |
71-
echo "Generating final documentation..."
65+
echo "Generating Markdown documentation..."
7266
73-
GENERATED_PROMPT=$(jq -n --arg extracted_content "$(cat extracted_details.txt)" '{
74-
"model": "gpt-4o",
75-
"messages": [
76-
{
77-
"role": "system",
78-
"content": "You are a professional technical writing assistant.\n\nObjective:\nYou will receive developer-extracted command and property data.\nYour task is to generate strict, professional Markdown integration documentation in a style consistent with platforms like Stripe, Slack, and Google Cloud.\n\n---\n\n# Output Format (Strict Markdown Only)\n\nUse the exact structure:\n\n```markdown\n# <Integration Name> Integration\n\nThis page provides information on how to connect to <Integration Name>. It enables users to perform actions such as <summary like creating events, managing contacts, checking availability>.\n\n## Connect <Integration Name>\n\nExplain how to authenticate and connect to this service.\n\n## Query <Integration Name>\n\nThe following section provides a reference guide describing available commands and their parameters.\n\n---\n\n### <Command Name>\n\n(One sentence summary explaining the purpose of this command.)\n\n#### <Property Name> `data type`\n\n<dd>\n\nWrite 2–4 full sentences in paragraph form.\nExplain what this property is used for, what formats it accepts (e.g., ISO 8601, Unix, array), and what happens if omitted (for optional fields).\nIf it's an ID, also explain where to find it and what format it follows.\n\n*example*:\n```\n<insert example value>\n```\n\n</dd>\n\n---\n\n(Repeat for each command)\n```"
79-
},
80-
{
81-
"role": "user",
82-
"content": $extracted_content
83-
}
84-
],
85-
"temperature": 0.3
86-
}')
87-
88-
echo "$GENERATED_PROMPT" > generate_prompt.json
67+
EXTRACTED_CONTENT=$(cat extracted_details.txt | jq -Rs .)
8968
9069
FINAL_DOC=$(curl -s https://api.openai.com/v1/chat/completions \
9170
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
9271
-H "Content-Type: application/json" \
93-
--data-binary @generate_prompt.json | jq -r '.choices[0].message.content')
94-
95-
echo "$FINAL_DOC" > generated_doc.md
96-
echo "Documentation generated."
72+
-d '{
73+
"model": "gpt-4o",
74+
"messages": [
75+
{
76+
"role": "system",
77+
"content": "You are a professional technical writing assistant. Given extracted details, generate strict, professional Markdown integration documentation. Use # headings, <dd> tags, examples inside fenced code blocks, etc. Follow Stripe/Slack/Google Cloud doc style."
78+
},
79+
{
80+
"role": "user",
81+
"content": '"$EXTRACTED_CONTENT"'
82+
}
83+
],
84+
"temperature": 0.3
85+
}')
86+
87+
echo "$FINAL_DOC" | jq -r '.choices[0].message.content' > generated_doc.md
9788
9889
- name: Upload generated documentation
9990
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)