Merge pull request #160 from softflow24/dependabot/npm_and_yarn/devel… #36
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: Sync Development to Main | |
on: | |
push: | |
branches: | |
- development | |
workflow_dispatch: | |
jobs: | |
sync-branches: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "[email protected]" | |
- name: Setup SSH Keys and known_hosts | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$DEPLOY_KEY" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Fetch all branches | |
run: | | |
git fetch --all | |
git fetch --tags | |
- name: Sync development to main | |
run: | | |
git checkout main | |
git merge origin/development --ff-only -m "Fast-forward main to latest development" | |
git push [email protected]:${GITHUB_REPOSITORY}.git main | |
- name: Handle merge conflicts or non-fast-forward situations | |
if: failure() | |
run: | | |
echo "⚠️ Unable to fast-forward. There might be commits on main that are not in development." | |
echo "Please review the branches and merge manually if necessary." | |
exit 1 |