File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Process Sample Workflow Files
2+
3+ on :
4+ push :
5+ paths :
6+ - ' website/docs/sample-workflow-tests/**' # Only trigger when something changes inside this folder
7+
8+ jobs :
9+ detect_and_run_sample_api :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout the repository
14+ uses : actions/checkout@v4
15+
16+ - name : Detect newly added or modified files
17+ id : detect_files
18+ run : |
19+ echo "Detecting changes..."
20+ git fetch origin main
21+ CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -- 'website/docs/sample-workflow-tests/' || true)
22+
23+ echo "Changed files:"
24+ echo "$CHANGED_FILES"
25+
26+ # Save changed files into output
27+ echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
28+
29+ - name : Run Sample API if new file detected
30+ if : steps.detect_files.outputs.changed_files != ''
31+ run : |
32+ echo "Running Sample API call..."
33+
34+ curl https://api.openai.com/v1/chat/completions \
35+ -H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
36+ -H "Content-Type: application/json" \
37+ -d '{
38+ "model": "gpt-4o",
39+ "messages": [{"role": "user", "content": "Test message from GitHub Actions"}],
40+ "temperature": 0.2
41+ }'
42+
43+ echo "Sample API call completed."
You can’t perform that action at this time.
0 commit comments