-
Notifications
You must be signed in to change notification settings - Fork 4
47 lines (39 loc) · 1.18 KB
/
sync-demo-code.yml
File metadata and controls
47 lines (39 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Sync Demo Code
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- name: Install dependencies
run: npm i
- name: Sync demo code
run: npx nx sync-demo-code
- name: Validate demo code
run: npx nx validate-demo-code
- name: Create PR if changes exist
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "No changes to sync."
exit 0
fi
BRANCH="chore/sync-demo-code-$(date +%Y%m%d%H%M%S)"
git checkout -b "$BRANCH"
git commit -m "chore: sync demo code"
git push --set-upstream origin "$BRANCH"
gh pr create --title "chore: sync demo code" --body "Automated sync of demo code." --base main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}