Use GITHUB_TOKEN in GitHub Actions #40
This file contains hidden or 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 | |
| permissions: | |
| contents: write | |
| jobs: | |
| merge: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Fetch and Checkout Main | |
| run: | | |
| git fetch origin | |
| git checkout main | |
| - name: Merge Development into Main | |
| run: | | |
| if ! git merge --no-ff development -m "Automated merge from development to main"; then | |
| echo "Merge conflict detected, auto-resolving README.md..." | |
| git checkout main -- README.md 2>/dev/null || git rm README.md 2>/dev/null || true | |
| git add -A | |
| git commit --no-edit | |
| fi | |
| - name: Push Changes | |
| run: git push origin main |