Skip to content

Commit 51966cb

Browse files
authored
Merge pull request #9 from bcaton85/ci-branch-sync
ci: adding job to sync master with release branches
2 parents ed62007 + 7b8bf91 commit 51966cb

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/branch-sync.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Sync Master to Release Branch
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
sync_master_to_release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Configure Git
18+
run: |
19+
git config user.name "GitHub Actions Bot"
20+
git config user.email "[email protected]"
21+
22+
- name: Merge master into release
23+
run: |
24+
BRANCH_NAME="redhat-3.15"
25+
echo "Syncing master to $BRANCH_NAME"
26+
git checkout master
27+
git pull origin master
28+
MASTER_COMMIT=$(git rev-parse HEAD)
29+
30+
git fetch origin $BRANCH_NAME
31+
git checkout $BRANCH_NAME
32+
git pull origin $BRANCH_NAME
33+
RELEASE_COMMIT=$(git rev-parse HEAD)
34+
echo "Rebasing $BRANCH_NAME ($RELEASE_COMMIT) onto master ($MASTER_COMMIT)"
35+
git rebase master
36+
git push origin $BRANCH_NAME
37+
38+
echo "Merged master ($MASTER_COMMIT) into $BRANCH_NAME ($RELEASE_COMMIT)"
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)