Skip to content

Commit e113190

Browse files
authored
Update sample-file-trigger.yml
1 parent 8a1713d commit e113190

File tree

1 file changed

+43
-54
lines changed

1 file changed

+43
-54
lines changed

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

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,84 +19,73 @@ jobs:
1919
echo "Detecting changes..."
2020
git fetch origin main
2121
CHANGED_FILE=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -- 'website/docs/sample-workflow-tests/' | head -n 1 || true)
22-
2322
if [ -z "$CHANGED_FILE" ]; then
2423
echo "No relevant file found. Exiting."
2524
exit 0
2625
fi
27-
2826
echo "Changed file detected: $CHANGED_FILE"
2927
echo "file_path=$CHANGED_FILE" >> $GITHUB_ENV
3028
3129
- name: Read file content
3230
id: read_file
3331
run: |
3432
echo "Reading file content..."
35-
CONTENT=$(cat ${{ env.file_path }} | jq -Rs .)
36-
echo "file_content=$CONTENT" >> $GITHUB_ENV
33+
FILE_CONTENT=$(cat ${{ env.file_path }} | jq -Rs .)
34+
echo "file_content=$FILE_CONTENT" >> $GITHUB_ENV
3735
3836
- name: Extract Commands and Properties (OpenAI Part 1)
3937
id: extract_details
4038
run: |
41-
echo "Sending JSON to OpenAI for extraction..."
42-
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 \
39+
echo "Extracting commands and properties..."
40+
curl -s https://api.openai.com/v1/chat/completions \
6141
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
6242
-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."
43+
-d @- <<EOF | jq -r '.choices[0].message.content' > extracted_info.md
44+
{
45+
"model": "gpt-4o",
46+
"messages": [
47+
{
48+
"role": "system",
49+
"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."
50+
},
51+
{
52+
"role": "user",
53+
"content": ${{ env.file_content }}
54+
}
55+
],
56+
"temperature": 0
57+
}
58+
EOF
6759

6860
- name: Generate Markdown Documentation (OpenAI Part 2)
6961
id: generate_doc
7062
run: |
71-
echo "Generating final documentation..."
72-
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
89-
90-
FINAL_DOC=$(curl -s https://api.openai.com/v1/chat/completions \
63+
echo "Generating final Markdown documentation..."
64+
EXTRACTED_CONTENT=$(cat extracted_info.md | jq -Rs .)
65+
curl -s https://api.openai.com/v1/chat/completions \
9166
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
9267
-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."
68+
-d @- <<EOF | jq -r '.choices[0].message.content' > generated_doc.md
69+
{
70+
"model": "gpt-4o",
71+
"messages": [
72+
{
73+
"role": "system",
74+
"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\nUse:\n- Strict Markdown (#, ##, ### headings)\n- <dd> tags for properties\n- Example sections inside fenced code blocks\n- No bullet points or extra JSON\n- Write full sentences, professional tone."
75+
},
76+
{
77+
"role": "user",
78+
"content": $EXTRACTED_CONTENT
79+
}
80+
],
81+
"temperature": 0.3
82+
}
83+
EOF
9784

9885
- name: Upload generated documentation
9986
uses: actions/upload-artifact@v4
10087
with:
101-
name: generated-doc
102-
path: generated_doc.md
88+
name: documentation-files
89+
path: |
90+
extracted_info.md
91+
generated_doc.md

0 commit comments

Comments
 (0)