Update Opportunities page (#72) #65
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 Branches with Main | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| branches: [content] # Add new branches here | |
| steps: | |
| - name: Checkout Main Branch | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Git User | |
| run: | | |
| git config user.name "GitHub Action" | |
| git config user.email "action@github.com" | |
| - name: Sync with ${{ matrix.branch }} | |
| run: | | |
| TARGET_BRANCH="${{ matrix.branch }}" | |
| git fetch --all --prune | |
| # Checkout the target branch and ensure it's up-to-date with origin | |
| git checkout ${TARGET_BRANCH} | |
| git pull --no-rebase origin ${TARGET_BRANCH} || true | |
| # Merge origin/main into the target branch (automatic merge). | |
| # Use --no-ff to create an explicit merge commit when required and | |
| # --no-edit to avoid interactive editor for the merge message. | |
| if git merge --no-ff --no-edit origin/main; then | |
| git push origin ${TARGET_BRANCH} | |
| else | |
| # On merge conflict, abort and push a backup branch so nothing is lost. | |
| git merge --abort || true | |
| BACKUP_BRANCH="backup/${TARGET_BRANCH}-merge-failed-$(date +%s)" | |
| git push origin HEAD:refs/heads/${BACKUP_BRANCH} | |
| echo "Merge failed. Backup pushed to ${BACKUP_BRANCH}. Exiting with failure." | |
| exit 1 | |
| fi |