-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (26 loc) · 1004 Bytes
/
on_merge.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
name: Auto rebase the latest version branch with main
on:
push:
branches:
- main
jobs:
synchronise_version_branch:
name: Synchronize the latest branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get branch for the latest version
run: |
echo hello
echo $(git for-each-ref --format='%(refname:short)' refs/heads)
echo $(git for-each-ref --format='%(refname:short)' refs/heads | grep -Po '^v\d.\d(.\d)?$')
echo $(git for-each-ref --format='%(refname:short)' refs/heads | grep -Po '^v\d.\d(.\d)?$' | sort -V | tail -n 1)
echo "DATA_LATEST_VERSION=$(git for-each-ref --format='%(refname:short)' refs/heads | grep -Po '^v\d.\d(.\d)?$' | sort -V | tail -n 1)" >> $GITHUB_ENV
- name: Rebase and push
run: |
git switch $DATA_LATEST_VERSION
git rebase master
git push --force-with-lease