Skip to content

Commit ce00a36

Browse files
authored
Update sample-file-trigger.yml
1 parent 9a85677 commit ce00a36

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

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

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,35 @@ jobs:
1212
steps:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 2
1517

16-
- name: Detect changed files
18+
- name: Detect newly added file
1719
id: detect_files
1820
run: |
19-
git fetch origin main
20-
CHANGED_FILE=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -- 'website/docs/sample-workflow-tests/' | head -n 1 || true)
21-
if [ -z "$CHANGED_FILE" ]; then
22-
echo "No relevant file found. Exiting."
21+
echo "Detecting newly added files in sample-workflow-tests/..."
22+
ADDED_FILE=$(git diff --name-status HEAD~1 HEAD | awk '$1 == "A" && $2 ~ /^website\/docs\/sample-workflow-tests\// { print $2 }' | head -n 1)
23+
if [ -z "$ADDED_FILE" ]; then
24+
echo "No new file added in target folder. Exiting."
2325
exit 0
2426
fi
25-
echo "Changed file detected: $CHANGED_FILE"
26-
echo "file_path=$CHANGED_FILE" >> $GITHUB_ENV
27+
echo "New file detected: $ADDED_FILE"
28+
echo "file_path=$ADDED_FILE" >> $GITHUB_ENV
2729
28-
- name: Read file content
29-
id: read_file
30+
- name: Show file name and content
31+
id: show_file
3032
run: |
31-
echo "Reading changed file content..."
32-
FILE_CONTENT=$(cat ${{ env.file_path }})
33+
echo "Reading content of: ${{ env.file_path }}"
34+
echo "File path: ${{ env.file_path }}"
35+
cat "${{ env.file_path }}"
36+
FILE_CONTENT=$(cat "${{ env.file_path }}")
3337
echo "file_content<<EOF" >> $GITHUB_ENV
3438
echo "$FILE_CONTENT" >> $GITHUB_ENV
3539
echo "EOF" >> $GITHUB_ENV
3640
3741
- name: Extract Commands and Properties (OpenAI Part 1)
38-
id: extract_details
3942
run: |
40-
echo "Extracting commands and properties..."
43+
echo "Calling OpenAI to extract commands and properties..."
4144
SYSTEM_PROMPT=$(cat .github/prompts/extract_prompt.txt)
4245
USER_CONTENT="${{ env.file_content }}"
4346
@@ -55,8 +58,10 @@ jobs:
5558
-H "Content-Type: application/json" \
5659
-d "$PAYLOAD" | jq -r '.choices[0].message.content' > extracted_info.md
5760
61+
echo "✅ Extracted content:"
62+
cat extracted_info.md
63+
5864
- name: Generate Markdown Documentation (OpenAI Part 2)
59-
id: generate_doc
6065
run: |
6166
echo "Generating final Markdown documentation..."
6267
SYSTEM_PROMPT=$(cat .github/prompts/generate_prompt.txt)
@@ -76,6 +81,9 @@ jobs:
7681
-H "Content-Type: application/json" \
7782
-d "$PAYLOAD" | jq -r '.choices[0].message.content' > generated_doc.md
7883
84+
echo "✅ Generated documentation:"
85+
cat generated_doc.md
86+
7987
- name: Upload documentation artifacts
8088
uses: actions/upload-artifact@v4
8189
with:

0 commit comments

Comments
 (0)