Skip to content

Commit 178ecef

Browse files
committed
update the docs
1 parent d1e23f1 commit 178ecef

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

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

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,50 +38,55 @@ jobs:
3838
git config user.name "Cursor Agent"
3939
git config user.email "[email protected]"
4040
41+
- name: Check if already commented
42+
id: check_comment
43+
run: |
44+
EXISTING_COMMENT=$(gh pr view ${{ github.event.pull_request.number }} --json comments --jq '.comments[] | select(.author.login == "github-actions[bot]" and (.body | contains("🤖 **LLMs.txt Auto-Update**")))')
45+
if [ -n "$EXISTING_COMMENT" ]; then
46+
echo "already_commented=true" >> $GITHUB_OUTPUT
47+
else
48+
echo "already_commented=false" >> $GITHUB_OUTPUT
49+
fi
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
4153
- name: Post initial comment
54+
if: steps.check_comment.outputs.already_commented == 'false'
4255
run: |
4356
gh pr comment ${{ github.event.pull_request.number }} --body "🤖 **LLMs.txt Auto-Update**
4457
4558
Analyzing documentation changes to update llms.txt files...
4659
47-
💡 **Want to stop this process?** Comment \`stop\` below and I'll cancel the analysis.
60+
💡 **Want to stop this process?** Comment \`STOP CURSOR\` below and I'll cancel the analysis.
4861
49-
⏱️ This will timeout after 30 minutes."
62+
⏱️ This will timeout after 20 minutes."
5063
env:
5164
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5265

5366
- name: Update LLMs.txt files
54-
timeout-minutes: 30
67+
timeout-minutes: 20
5568
env:
5669
MODEL: gpt-5
5770
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
5871
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5972
BRANCH_PREFIX: auto-llms
6073
run: |
61-
# Expand variables for the agent
62-
REPO="${{ github.repository }}"
63-
OWNER="${{ github.repository_owner }}"
64-
PR_NUMBER="${{ github.event.pull_request.number }}"
65-
BASE_REF="${{ github.base_ref }}"
66-
HEAD_REF="${{ github.head_ref }}"
67-
BRANCH_PREFIX="${{ env.BRANCH_PREFIX }}"
68-
6974
cursor-agent -p "You are operating in a GitHub Actions runner to automatically update llms.txt and llms-full.txt files.
7075
7176
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.
7277
73-
IMPORTANT: Before starting your analysis, use the run_terminal_cmd tool to execute:
74-
gh pr view ${PR_NUMBER} --json comments --jq '.comments[] | select(.body | contains(\"stop\"))'
78+
IMPORTANT: Before starting your analysis, check if the user wants to stop by running:
79+
gh pr view ${{ github.event.pull_request.number }} --json comments --jq '.comments[] | select(.body | contains(\"STOP CURSOR\"))'
7580
76-
If this command returns any results, use run_terminal_cmd to post a cancellation comment on the PR and then use run_terminal_cmd to execute 'exit 0'. Otherwise, proceed with your analysis.
81+
If this returns any results, immediately post a cancellation comment and exit. Otherwise, proceed with your analysis.
7782
7883
# Context:
79-
- Repo: ${REPO}
80-
- Owner: ${OWNER}
81-
- PR Number: ${PR_NUMBER}
82-
- Base Ref: ${BASE_REF}
83-
- Head Ref: ${HEAD_REF}
84-
- Branch Prefix: ${BRANCH_PREFIX}
84+
- Repo: ${{ github.repository }}
85+
- Owner: ${{ github.repository_owner }}
86+
- PR Number: ${{ github.event.pull_request.number }}
87+
- Base Ref: ${{ github.base_ref }}
88+
- Head Ref: ${{ github.head_ref }}
89+
- Branch Prefix: ${{ env.BRANCH_PREFIX }}
8590
8691
# Documentation Structure:
8792
This is a docs repository with the following main directories that each contain llms.txt and llms-full.txt files:
@@ -98,17 +103,16 @@ jobs:
98103
Analyze changes in the original PR and determine if they are significant enough to warrant updating the llms.txt and llms-full.txt files for the affected directories. If so, create a separate PR with the updates.
99104
100105
# Requirements:
101-
1) Use run_terminal_cmd to execute \`gh pr diff ${PR_NUMBER}\` to analyze what changed in the original PR
106+
1) Use \`gh pr diff\` to analyze what changed in the original PR
102107
2) Determine which documentation directories are affected by the changes
103108
3) Assess if the changes are significant enough to update the llms.txt files (new content, major restructuring, new features, etc.)
104109
4) If changes are significant:
105-
- Use run_terminal_cmd to create or update a persistent branch named \`${BRANCH_PREFIX}/pr-${PR_NUMBER}\`
106-
- Use read_file to read existing llms.txt and llms-full.txt files
107-
- Use search_replace or write to update the relevant llms.txt and llms-full.txt files
108-
- Use run_terminal_cmd to push the changes to the branch
109-
- Use run_terminal_cmd to comment on the original PR with a summary and a compare link
110+
- Create or update a persistent branch named \`${{ env.BRANCH_PREFIX }}/pr-${{ github.event.pull_request.number }}\`
111+
- Update the relevant llms.txt and llms-full.txt files to reflect the new documentation structure and content
112+
- Push the changes to the branch
113+
- Comment on the original PR with a summary and a compare link to create the PR
110114
5) If changes are not significant:
111-
- Use run_terminal_cmd to comment on the original PR explaining that no llms.txt updates are needed
115+
- Comment on the original PR explaining that no llms.txt updates are needed
112116
113117
# File Format Guidelines:
114118
- llms.txt files should be concise, focused summaries with key links
@@ -129,7 +133,4 @@ jobs:
129133
- If updates needed: Pushed commits to the persistent branch and a PR comment with compare link
130134
- If no updates needed: A brief comment explaining why no updates are required
131135
- Keep all changes minimal and consistent with existing documentation style
132-
- Keep the changes to the minimum necessary to update the llms.txt and llms-full.txt files
133-
134-
CRITICAL: After completing ANY of the above actions (stop command, updates completed, or no updates needed), wait 30 seconds and then terminate the process. Do not continue running or use any more tools.
135-
" --force --model "$MODEL" --output-format=text
136+
" --force --model "$MODEL" --output-format=text

0 commit comments

Comments
 (0)