|
1 | | -name: Process Sample Files and Generate Docs |
| 1 | +name: Generate Markdown File and Upload |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - paths: |
6 | | - - 'website/docs/sample-workflow-tests/**' |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * 0' # Runs every Sunday at midnight UTC |
| 6 | + workflow_dispatch: |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - process_sample_file: |
| 9 | + merge-and-upload-markdown: |
10 | 10 | runs-on: ubuntu-latest |
11 | 11 |
|
12 | 12 | steps: |
13 | 13 | - name: Checkout repository |
14 | | - uses: actions/checkout@v4 |
| 14 | + uses: actions/checkout@v3 |
15 | 15 |
|
16 | | - - name: Detect changed files |
17 | | - id: detect_files |
| 16 | + - name: Merge markdown files |
18 | 17 | 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." |
23 | | - exit 0 |
24 | | - fi |
25 | | - echo "Changed file detected: $CHANGED_FILE" |
26 | | - echo "file_path=$CHANGED_FILE" >> $GITHUB_ENV |
| 18 | + find website/docs \( -name '*.md' -o -name '*.mdx' \) -exec cat {} + > appsmith-docs.md |
27 | 19 |
|
28 | | - - name: Read file content |
29 | | - id: read_file |
| 20 | + - name: Check file size |
30 | 21 | run: | |
31 | | - echo "Reading changed file content..." |
32 | | - FILE_CONTENT=$(cat ${{ env.file_path }} | jq -Rs .) |
33 | | - echo "file_content=$FILE_CONTENT" >> $GITHUB_ENV |
| 22 | + filesize=$(stat -c%s "appsmith-docs.md") |
| 23 | + echo "File size: $filesize bytes" |
34 | 24 |
|
35 | | - - name: Extract Commands and Properties (OpenAI Part 1) |
36 | | - id: extract_details |
| 25 | + - name: Upload merged markdown to API |
37 | 26 | run: | |
38 | | - echo "Extracting commands and properties..." |
39 | | - SYSTEM_PROMPT=$(cat .github/prompts/extract_prompt.txt | jq -Rs .) |
40 | | -
|
41 | | - curl -s https://api.openai.com/v1/chat/completions \ |
42 | | - -H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \ |
43 | | - -H "Content-Type: application/json" \ |
44 | | - -d @- <<EOF | jq -r '.choices[0].message.content' > extracted_info.md |
45 | | -{ |
46 | | - "model": "gpt-4o", |
47 | | - "messages": [ |
48 | | - { "role": "system", "content": $SYSTEM_PROMPT }, |
49 | | - { "role": "user", "content": ${{ env.file_content }} } |
50 | | - ], |
51 | | - "temperature": 0 |
52 | | -} |
53 | | -EOF |
54 | | - |
55 | | - - name: Generate Markdown Documentation (OpenAI Part 2) |
56 | | - id: generate_doc |
57 | | - run: | |
58 | | - echo "Generating final Markdown documentation..." |
59 | | - SYSTEM_PROMPT=$(cat .github/prompts/generate_prompt.txt | jq -Rs .) |
60 | | - EXTRACTED_CONTENT=$(cat extracted_info.md | jq -Rs .) |
61 | | -
|
62 | | - curl -s https://api.openai.com/v1/chat/completions \ |
63 | | - -H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \ |
64 | | - -H "Content-Type: application/json" \ |
65 | | - -d @- <<EOF | jq -r '.choices[0].message.content' > generated_doc.md |
66 | | -{ |
67 | | - "model": "gpt-4o", |
68 | | - "messages": [ |
69 | | - { "role": "system", "content": $SYSTEM_PROMPT }, |
70 | | - { "role": "user", "content": $EXTRACTED_CONTENT } |
71 | | - ], |
72 | | - "temperature": 0.3 |
73 | | -} |
74 | | -EOF |
75 | | - |
76 | | - - name: Upload documentation artifacts |
77 | | - uses: actions/upload-artifact@v4 |
78 | | - with: |
79 | | - name: documentation-files |
80 | | - path: | |
81 | | - extracted_info.md |
82 | | - generated_doc.md |
| 27 | + response=$(curl -X POST \ |
| 28 | + -H "Content-Type: text/markdown" \ |
| 29 | + --data-binary "@appsmith-docs.md" \ |
| 30 | + https://hook.eu1.make.com/78ylobuaxpwb4w8k3lbfgmdlwow9d8m5) |
| 31 | + echo "Response: $response" |
0 commit comments