Skip to content

Commit 1e5e31d

Browse files
authored
feat: update llm-docs workflow to use auto-merge PR (#2528)
Update the llm-docs GitHub Actions workflow to create a pull request with auto-merge enabled instead of pushing directly to the main branch. Changes: - Create timestamped feature branch for changes - Commit changes to feature branch - Create PR using gh CLI - Enable auto-merge with squash strategy
1 parent 728a01e commit 1e5e31d

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

.github/workflows/llm-docs.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,42 @@ jobs:
2020
2121
2222
- name: Check for changes
23+
id: changes
2324
run: |
2425
if git diff --quiet; then
2526
echo "No changes to llms.txt; exiting."
26-
exit 0
27+
echo "has_changes=false" >> $GITHUB_OUTPUT
2728
else
2829
echo "Changes detected in llms.txt."
30+
echo "has_changes=true" >> $GITHUB_OUTPUT
2931
fi
3032
31-
- name: Commit and push changes
33+
- name: Create PR with auto-merge
34+
if: steps.changes.outputs.has_changes == 'true'
3235
env:
3336
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3437
run: |
35-
git config user.name "${{ github.actor }}"
36-
git config user.email "${{ github.actor }}@users.noreply.github.com"
38+
# Configure git
39+
git config user.name "github-actions[bot]"
40+
git config user.email "github-actions[bot]@users.noreply.github.com"
41+
42+
# Create and switch to a new branch
43+
BRANCH_NAME="update-llm-docs-$(date +%Y%m%d%H%M%S)"
44+
git checkout -b "$BRANCH_NAME"
45+
46+
# Commit changes
3747
git add docs/llms.txt
38-
git commit -m "Update llms.txt"
39-
git push origin main
48+
git commit -m "docs: update llms.txt"
49+
50+
# Push the branch
51+
git push origin "$BRANCH_NAME"
52+
53+
# Create PR with auto-merge enabled
54+
gh pr create \
55+
--title "docs: update llms.txt" \
56+
--body "This PR updates the llms.txt file with the latest documentation changes." \
57+
--head "$BRANCH_NAME" \
58+
--base main
59+
60+
# Enable auto-merge
61+
gh pr merge "$BRANCH_NAME" --auto --squash

0 commit comments

Comments
 (0)