add rebase-release-branches-on-master-branch-commits.yml (fixup) #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rebase-release-branches-on-master-branch-commits | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: rebase all release branches | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -x # enable traces | |
#pwd | |
#find . | |
# configure git | |
git config --global user.name "actions/k3s-boshrelease" | |
git config --global user.email "<>" | |
git config --global --add safe.directory /github/workspace | |
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" | |
# Note: actions/checkout does not include local branches, see https://github.com/actions/checkout/issues/1017#issuecomment-1344861321 | |
# therefore we iterate on remote branches | |
git branch -r | |
RELEASE_BRANCHES=$(git branch -r --list "origin/release-*") | |
for r in ${RELEASE_BRANCHES}; do | |
BRANCH_WITHOUT_PREFIX=${r#/origin} | |
git checkout ${BRANCH_WITHOUT_PREFIX} | |
git rebase master | |
#git push --force ${remote_repo} HEAD:$r | |
done | |