update-dev #958
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: update-dev | |
on: | |
workflow_run: | |
workflows: | |
- Build Website - JSON | |
types: | |
- completed | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
jobs: | |
update-dev: | |
runs-on: ubuntu-latest | |
if: >- | |
${{ | |
github.event_name != 'workflow_run' || | |
( | |
github.event_name == 'workflow_run' && | |
github.event.workflow_run.event == 'push' | |
) | |
}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.NIGHTLY_TOKEN }} | |
fetch-depth: 0 # We want entire git-history to avoid any merge conflicts | |
- name: Nightly Merge | |
env: | |
CONFIG_USERNAME: GitHub Nightly Merge Action | |
CONFIG_EMAIL: [email protected] | |
MERGE_HEAD: master | |
MERGE_BASE: dev | |
MERGE_ARGS: --no-ff --allow-unrelated-histories --no-edit | |
run: | | |
# This script is adapted from the robotology/[email protected] GitHub action: | |
# https://github.com/robotology/gh-action-nightly-merge/blob/master/entrypoint.sh | |
git config --global user.name "$CONFIG_USERNAME" | |
git config --global user.email "$CONFIG_EMAIL" | |
git fetch origin $MERGE_HEAD | |
(git checkout $MERGE_HEAD && git pull origin $MERGE_HEAD) | |
git fetch origin $MERGE_BASE | |
(git checkout $MERGE_BASE && git pull origin $MERGE_BASE) | |
git merge $MERGE_ARGS $MERGE_HEAD | |
git push origin $MERGE_BASE |