Skip to content

Commit 95f1bc9

Browse files
authored
Update sample-file-trigger.yml
1 parent 1d8827c commit 95f1bc9

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

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

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
- name: Detect changed files
1717
id: detect_files
1818
run: |
19-
echo "Detecting changes..."
2019
git fetch origin main
2120
CHANGED_FILE=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -- 'website/docs/sample-workflow-tests/' | head -n 1 || true)
2221
if [ -z "$CHANGED_FILE" ]; then
@@ -29,60 +28,50 @@ jobs:
2928
- name: Read file content
3029
id: read_file
3130
run: |
32-
echo "Reading file content..."
31+
echo "Reading changed file content..."
3332
FILE_CONTENT=$(cat ${{ env.file_path }} | jq -Rs .)
3433
echo "file_content=$FILE_CONTENT" >> $GITHUB_ENV
3534
3635
- name: Extract Commands and Properties (OpenAI Part 1)
3736
id: extract_details
3837
run: |
39-
echo "Extracting commands and properties..."
38+
SYSTEM_PROMPT=$(cat .github/prompts/extract_prompt.txt | jq -Rs .)
4039
curl -s https://api.openai.com/v1/chat/completions \
4140
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
4241
-H "Content-Type: application/json" \
43-
-d @- <<EOF | jq -r '.choices[0].message.content' > extracted_info.md
42+
-d "$(cat <<EOF
4443
{
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-
}
44+
\"model\": \"gpt-4o\",
45+
\"messages\": [
46+
{ \"role\": \"system\", \"content\": $SYSTEM_PROMPT },
47+
{ \"role\": \"user\", \"content\": ${{ env.file_content }} }
5548
],
56-
"temperature": 0
49+
\"temperature\": 0
5750
}
5851
EOF
52+
)" | jq -r '.choices[0].message.content' > extracted_info.md
5953

6054
- name: Generate Markdown Documentation (OpenAI Part 2)
6155
id: generate_doc
6256
run: |
63-
echo "Generating final Markdown documentation..."
57+
SYSTEM_PROMPT=$(cat .github/prompts/generate_prompt.txt | jq -Rs .)
6458
EXTRACTED_CONTENT=$(cat extracted_info.md | jq -Rs .)
6559
curl -s https://api.openai.com/v1/chat/completions \
6660
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
6761
-H "Content-Type: application/json" \
68-
-d @- <<EOF | jq -r '.choices[0].message.content' > generated_doc.md
62+
-d "$(cat <<EOF
6963
{
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-
}
64+
\"model\": \"gpt-4o\",
65+
\"messages\": [
66+
{ \"role\": \"system\", \"content\": $SYSTEM_PROMPT },
67+
{ \"role\": \"user\", \"content\": $EXTRACTED_CONTENT }
8068
],
81-
"temperature": 0.3
69+
\"temperature\": 0.3
8270
}
8371
EOF
72+
)" | jq -r '.choices[0].message.content' > generated_doc.md
8473

85-
- name: Upload generated documentation
74+
- name: Upload documentation artifacts
8675
uses: actions/upload-artifact@v4
8776
with:
8877
name: documentation-files

0 commit comments

Comments
 (0)