Skip to content

Commit 3b5f02e

Browse files
committed
update gh workflow to create PR when ai docs are affected
1 parent f4d3739 commit 3b5f02e

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.github/workflows/update-latest.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,36 @@ jobs:
2929
- name: Generate AI file
3030
run: yarn generate:ai
3131

32-
- name: Run git config
33-
run: |
34-
git config user.name "GitHub Actions Bot"
35-
git config user.email "<>"
36-
37-
- name: Commit and push changes
32+
- name: Create Pull Request
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3835
run: |
3936
if [[ -n "$(git status --porcelain)" ]]; then
40-
git add .
37+
# Configure git
38+
git config user.name "github-actions[bot]"
39+
git config user.email "github-actions[bot]@users.noreply.github.com"
40+
41+
# Create and switch to new branch
42+
BRANCH_NAME="update-ai-docs-$(date +%Y%m%d-%H%M%S)"
43+
git checkout -b "$BRANCH_NAME"
44+
45+
# Commit changes
46+
git add ai/liquid.mdc
47+
git add data/latest.json
4148
git commit -m "Update 'ai/liquid.mdc' and 'data/latest.json' files"
42-
git push origin main
49+
50+
# Push branch
51+
git push origin "$BRANCH_NAME"
52+
53+
# Create pull request using GitHub CLI
54+
gh pr create \
55+
--title "Update 'ai/liquid.mdc' and 'data/latest.json' files" \
56+
--body "Automated update of AI documentation and latest revision data.
57+
58+
- Updated \`ai/liquid.mdc\` with latest documentation
59+
- Updated \`data/latest.json\` with current revision SHA" \
60+
--base main \
61+
--head "$BRANCH_NAME"
4362
else
4463
echo "No changes to commit"
4564
fi

0 commit comments

Comments
 (0)