Skip to content

Commit

Permalink
Add workflow to rebase all desired branches (#11)
Browse files Browse the repository at this point in the history
* Refs #13950: add workflow to rebase all desired branches

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Added Humble-related modifications

Signed-off-by: Javier Santiago <[email protected]>

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>
Signed-off-by: Javier Santiago <[email protected]>
Co-authored-by: Javier Santiago <[email protected]>
  • Loading branch information
2 people authored and richiprosima committed Dec 27, 2023
1 parent 6e95aa9 commit d198a76
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions .github/workflows/rebase-ros-rmw_fastrtps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,65 @@ on:
- cron: '0 0 * * *'
# scheduled every midnight
workflow_dispatch:
# manual run of the workflow job
#manual run of the workflow job

jobs:
rebase-current-branch:
rebase-branches:
name: Rebase HEAD with upstream current branch
runs-on: ubuntu-latest

strategy:
matrix:
dest_branch: ['master', 'galactic', 'humble', 'vulcanexus', 'vulcanexus-galactic', 'vulcanexus-humble']

steps:
# Step 1: run a standard checkout action, provided by github (REQUIRED)
- name: Checkout target repo
uses: actions/checkout@v2
with:
ref: ${{ matrix.dest_branch }}
fetch-depth: 0

# Step 2: rebase action (REQUIRED)
- name: Rebase current branch to upstream changes
id: rebase
# Step 2: Set git config and add remote (REQUIRED)
- name: Set git config and add remote
id: config
run: |
git remote add ros https://github.com/ros2/rmw_fastrtps.git
git fetch ros ${GITHUB_REF##*/}
git config --local user.email "[email protected]"
git config --local user.name "richiprosima"
git rebase ros/${GITHUB_REF##*/}
if [ "$(git status | grep diverged)" ]; then
git remote add ros https://github.com/ros2/rmw_fastrtps.git
shell: bash

# Step 3: Rebase
- name: Rebase current branch to upstream changes
id: rebase_master_galactic
run: |
git fetch ros ${{ matrix.dest_branch }}
git rebase ros/${{ matrix.dest_branch }}
shell: bash
if: matrix.dest_branch == 'master' || matrix.dest_branch == 'galactic' || matrix.dest_branch == 'humble'
- id: rebase_vulcanexus
run: |
git fetch ros master
git rebase ros/master
shell: bash
if: matrix.dest_branch == 'vulcanexus'
- id: rebase_vulcanexus_galactic
run: |
git fetch ros galactic
git rebase ros/galactic
shell: bash
if: matrix.dest_branch == 'vulcanexus-galactic'
- id: rebase_vulcanexus_humble
run: |
git fetch ros humble
git rebase ros/humble
shell: bash
if: matrix.dest_branch == 'vulcanexus-humble'

# Step 4: Push
- name: Force push if required
id: push
run: |
if [ "$(git status | grep 'diverged\|ahead')" ]; then
git push -f
fi;
shell: bash

0 comments on commit d198a76

Please sign in to comment.