Release v1.5.13 #32
Workflow file for this run
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 Cloud Branch | |
on: | |
release: | |
types: [published] | |
# on demand | |
workflow_dispatch: | |
jobs: | |
sync-cloud: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Important for getting all branches and history | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Sync cloud branch | |
run: | | |
# Fetch all branches | |
git fetch origin | |
# Check if cloud branch exists | |
if git show-ref --verify --quiet refs/remotes/origin/cloud; then | |
# Switch to cloud branch | |
git checkout cloud | |
# Ensure we're up to date | |
git pull origin cloud | |
# Merge main into cloud | |
git merge --no-ff origin/main -m "Merge main branch for release ${{ github.event.release.tag_name }}" | |
# Push changes | |
git push origin cloud | |
else | |
# Create and push cloud branch if it doesn't exist | |
git checkout -b cloud | |
git push --set-upstream origin cloud | |
fi | |
- name: Handle merge conflicts | |
if: failure() | |
run: | | |
# If there were merge conflicts, abort and create an issue | |
git merge --abort || true | |
# Create an issue using GitHub API | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/issues \ | |
-d '{ | |
"title": "Merge Conflict: main to cloud sync failed", | |
"body": "There was a merge conflict while trying to sync main branch to cloud branch for release ${{ github.event.release.tag_name }}.\n\nPlease resolve conflicts manually.", | |
"labels": ["merge-conflict", "bot"] | |
}' | |
# Fail the workflow | |
exit 1 |