Skip to content

Commit 8cba45a

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

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

.github/workflows/update-latest.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Update 'ai/liquid.mdc' and 'data/latest.json' files
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches:
7-
- main
85

96
jobs:
107
build:
@@ -29,17 +26,36 @@ jobs:
2926
- name: Generate AI file
3027
run: yarn generate:ai
3128

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

0 commit comments

Comments
 (0)