Create asanaa_uqi_config.json #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Process Sample Files and Generate Docs | |
| on: | |
| push: | |
| paths: | |
| - 'website/docs/sample-workflow-tests/**' | |
| jobs: | |
| process_sample_file: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Detect changed files | |
| id: detect_files | |
| run: | | |
| git fetch origin main | |
| CHANGED_FILE=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -- 'website/docs/sample-workflow-tests/' | head -n 1 || true) | |
| if [ -z "$CHANGED_FILE" ]; then | |
| echo "No relevant file found. Exiting." | |
| exit 0 | |
| fi | |
| echo "file_path=$CHANGED_FILE" >> $GITHUB_ENV | |
| - name: Read file content | |
| id: read_file | |
| run: | | |
| echo "Reading changed file content..." | |
| FILE_CONTENT=$(cat ${{ env.file_path }} | jq -Rs .) | |
| echo "file_content=$FILE_CONTENT" >> $GITHUB_ENV | |
| - name: Extract Commands and Properties (OpenAI Part 1) | |
| id: extract_details | |
| run: | | |
| echo "Extracting commands and properties..." | |
| SYSTEM_PROMPT=$(jq -Rs . < .github/prompts/extract_prompt.txt) | |
| USER_CONTENT=${{ env.file_content }} | |
| PAYLOAD=$(jq -n --arg sys "$SYSTEM_PROMPT" --arg usr "$USER_CONTENT" '{ | |
| model: "gpt-4o", | |
| messages: [ | |
| { role: "system", content: $sys }, | |
| { role: "user", content: $usr } | |
| ], | |
| temperature: 0 | |
| }') | |
| curl -s https://api.openai.com/v1/chat/completions \ | |
| -H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" | jq -r '.choices[0].message.content' > extracted_info.md | |
| - name: Generate Markdown Documentation (OpenAI Part 2) | |
| id: generate_doc | |
| run: | | |
| echo "Generating final Markdown documentation..." | |
| SYSTEM_PROMPT=$(jq -Rs . < .github/prompts/generate_prompt.txt) | |
| EXTRACTED_CONTENT=$(jq -Rs . < extracted_info.md) | |
| PAYLOAD=$(jq -n --arg sys "$SYSTEM_PROMPT" --arg usr "$EXTRACTED_CONTENT" '{ | |
| model: "gpt-4o", | |
| messages: [ | |
| { role: "system", content: $sys }, | |
| { role: "user", content: $usr } | |
| ], | |
| temperature: 0.3 | |
| }') | |
| curl -s https://api.openai.com/v1/chat/completions \ | |
| -H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" | jq -r '.choices[0].message.content' > generated_doc.md | |
| - name: Upload documentation artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentation-files | |
| path: | | |
| extracted_info.md | |
| generated_doc.md |