forked from loft-sh/vcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (39 loc) · 1.28 KB
/
sync-config.yaml
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
48
49
name: Sync Config
on:
push:
branches:
- main
paths:
- "config/**.go"
- "chart/values.schema.json"
- ".github/workflows/sync-config.yaml"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Configure git
run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Clone and update
run: |
git clone --single-branch https://github.com/loft-sh/vcluster-config.git
cp -R config/. vcluster-config/config/
cp chart/values.schema.json vcluster-config/values.schema.json
cd vcluster-config
# Checkout new branch
git add --all
# if there are no changes, exit early
if git diff-index --quiet HEAD --; then
exit 0
fi
# set git info
git config --global user.name "Loft Bot"
git config --global user.email 'loft-bot@users.noreply.github.com'
echo "Changes detected"
# commit changes
git commit -m "chore: sync vCluster config"
git push -u origin -f main
echo "Pushed commit to main branch"