Libcontroller Updater #766
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: Libcontroller Updater | |
on: | |
schedule: | |
- cron: '0 04 * * *' | |
jobs: | |
automatic-libcontroller-sync: | |
strategy: | |
matrix: | |
include: | |
- webots_ros2_branch: master | |
- webots_ros2_branch: develop | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
with: | |
submodules: "true" | |
fetch-depth: 0 | |
ref: ${{ matrix.webots_ros2_branch }} | |
- name: Copy Webots libController files | |
run: scripts/sync_controller_lib.sh ${{ matrix.webots_ros2_branch }} | |
- name: Create commit if necessary | |
id: create-commit | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Submodule needs sync!"; | |
git config --global user.name ${GITHUB_ACTOR} | |
git config --global user.email ${GITHUB_ACTOR}@github.com | |
git checkout -b ${{ env.BRANCH_NAME }} | |
git add . | |
git commit -m "Sync submodule" | |
git push origin ${{ env.BRANCH_NAME }} | |
echo "create_pull_request=1" >> $GITHUB_OUTPUT | |
else | |
echo "Submodule is already up to date."; | |
echo "create_pull_request=0" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Pull Request | |
if: ${{ steps.create-commit.outputs.create_pull_request == 1 }} | |
uses: repo-sync/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
source_branch: ${{ env.BRANCH_NAME }} | |
destination_branch: ${{ matrix.webots_ros2_branch }} | |
pr_title: Sync libcontroller ${{ matrix.webots_ros2_branch }} | |
pr_body: Synchronizes libcontroller to the latest commit of branch ${{ matrix.webots_ros2_branch }}. | |
pr_reviewer: Maintainers |