forked from apache/incubator-kie-drools
-
Notifications
You must be signed in to change notification settings - Fork 33
48 lines (37 loc) · 1.25 KB
/
upstream-sync.yml
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
name: Sync main-apache branch with upstream/main
env:
USERNAME: kie-ci
USEREMAIL: [email protected]
UPSTREAM_REMOTE: https://github.com/apache/incubator-kie-drools.git
GITHUB_TOKEN: ${{ secrets.APACHE_SYNC_MIDSTREAM_TOKEN }}
on:
schedule:
- cron: "0 0 * * *" # every day at midnight
workflow_dispatch:
jobs:
sync-main-apache:
if: github.repository_owner == 'kiegroup'
name: Sync main-apache branch
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.APACHE_SYNC_MIDSTREAM_TOKEN }}
- name: Setup git environment
run: |
git config --global user.name "$USERNAME"
git config --global user.email "$USEREMAIL"
git remote add upstream $UPSTREAM_REMOTE
- name: Fetch all
run: git fetch --all --tags
- name: Checkout main-apache branch
run: git checkout --track origin/main-apache
- name: Pull main-apache branch
run: git pull
- name: Merge upstream/main branch
run: git merge --no-edit upstream/main
- name: Push changes
run: git push
- name: Push last tag
run: git push origin $(git tag --sort=creatordate | tail -n 1)