Skip to content

Commit e153967

Browse files
committed
add json parsing
1 parent f54c91e commit e153967

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.github/workflows/auto-llms-txt.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ jobs:
6666
HEAD_REF="${{ github.head_ref }}"
6767
BRANCH_PREFIX="${{ env.BRANCH_PREFIX }}"
6868
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.
7071
7172
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.
7273
@@ -130,4 +131,24 @@ jobs:
130131
- Keep all changes minimal and consistent with existing documentation style
131132
132133
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

Comments
 (0)