Closed levibostian closed 2 years ago
I implemented this but then realized that we don't want this change to happen.
The use case of this tool is to make sure that the ahead branch commits are put into the behind branch. There are use cases where the ahead branch being behind the behind branch is OK.
Let's say that you use the beta
branch for the latest beta deployment while the default branch is develop
.
Let's say that the latest beta
deployment was 3 weeks ago and you have been developing features in develop
ever since the latest beta
which means that develop
is ahead of beta
(and that's OK!). You then find a bug in beta
so you add a bug fix commit into the beta
branch. beta
is now ahead of develop
and you want to put that 1 commit into develop
. So, you use this tool to do that. You set beta
as the ahead branch and develop
as the behind branch. This tool copies over that 1 commit and the job is done. It's OK for beta
to remain behind from develop
! If you want them to be truly identical, you would run this tool twice:
name: Sync release branches with develop
on: [push]
jobs:
sync-branches:
name: Sync branches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: levibostian/action-sync-branches@v1
with:
behind: develop
ahead: beta
githubToken: ${{ secrets.BOT_PUSH_TOKEN }}
- uses: levibostian/action-sync-branches@v1
with:
behind: beta
ahead: develop
githubToken: ${{ secrets.BOT_PUSH_TOKEN }}
Today, when the script runs
git rebase
and then runsgit log X..Y
to check if the branches are identical, the script should also checkgit log Y..X
. Because there is a chance that branch X is behind and ahead in commits compared to branch Y.