|
66 | 66 | HEAD_REF="${{ github.head_ref }}" |
67 | 67 | BRANCH_PREFIX="${{ env.BRANCH_PREFIX }}" |
68 | 68 | |
69 | | - cursor-agent -p "You are operating in a GitHub Actions runner to automatically update llms.txt and llms-full.txt files. |
| 69 | + # Run cursor-agent and capture output |
| 70 | + AGENT_OUTPUT=$(cursor-agent -p "You are operating in a GitHub Actions runner to automatically update llms.txt and llms-full.txt files. |
70 | 71 |
|
71 | 72 | The GitHub CLI is available as \`gh\` and authenticated via \`GH_TOKEN\`. Git is available. You have write access to repository contents and can comment on pull requests, but you must not create or edit PRs directly. |
72 | 73 |
|
@@ -130,4 +131,24 @@ jobs: |
130 | 131 | - Keep all changes minimal and consistent with existing documentation style |
131 | 132 | |
132 | 133 | CRITICAL: After completing ANY of the above actions (stop command, updates completed, or no updates needed), you MUST immediately exit by running 'exit 0'. Do not continue running or wait for additional input. |
133 | | - " --force --model "$MODEL" --output-format=json |
| 134 | + " --force --model "$MODEL" --output-format=json) |
| 135 | + |
| 136 | + # Parse the JSON response |
| 137 | + echo "Agent output: $AGENT_OUTPUT" |
| 138 | + |
| 139 | + # Check if the agent completed successfully |
| 140 | + if echo "$AGENT_OUTPUT" | jq -e '.type == "result" and .subtype == "success"' > /dev/null; then |
| 141 | + echo "✅ Agent completed successfully" |
| 142 | + |
| 143 | + # Extract the result message |
| 144 | + RESULT_MESSAGE=$(echo "$AGENT_OUTPUT" | jq -r '.result') |
| 145 | + echo "Result: $RESULT_MESSAGE" |
| 146 | + |
| 147 | + # Force exit the action |
| 148 | + echo "🏁 Forcing action to exit" |
| 149 | + exit 0 |
| 150 | + else |
| 151 | + echo "❌ Agent did not complete successfully" |
| 152 | + echo "Raw output: $AGENT_OUTPUT" |
| 153 | + exit 1 |
| 154 | + fi |
0 commit comments