|
1 | 1 | name: Auto Release from Issue |
2 | 2 |
|
3 | | -# Trigger when an issue is opened or labeled with 'release' |
| 3 | +# Trigger when an issue is labeled with 'release' |
4 | 4 | on: |
5 | 5 | issues: |
6 | | - types: [opened, labeled] |
| 6 | + types: [labeled] |
7 | 7 | # Also trigger when PR is merged (to create tag after merge) |
8 | 8 | pull_request: |
9 | 9 | types: [closed] |
@@ -296,20 +296,36 @@ jobs: |
296 | 296 | gh api -X DELETE "repos/${{ github.repository }}/git/refs/heads/$BRANCH" || true |
297 | 297 | echo "✅ Branch '$BRANCH' deleted" |
298 | 298 |
|
299 | | - - name: '🔄 Sync develop with main' |
| 299 | + - name: '🔄 Create PR to sync develop with main' |
| 300 | + env: |
| 301 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
300 | 302 | run: | |
| 303 | + VERSION_TAG="${{ steps.version.outputs.version_tag }}" |
| 304 | + SYNC_BRANCH="sync/main-to-develop-${VERSION_TAG}" |
| 305 | +
|
301 | 306 | git config user.name "github-actions[bot]" |
302 | 307 | git config user.email "github-actions[bot]@users.noreply.github.com" |
303 | 308 |
|
304 | | - # Fetch all branches |
305 | | - git fetch origin develop:develop || true |
306 | | -
|
307 | 309 | # Check if develop branch exists |
308 | | - if git show-ref --verify --quiet refs/heads/develop; then |
309 | | - git checkout develop |
310 | | - git merge main -m "Sync develop with main after release ${{ steps.version.outputs.version_tag }}" |
311 | | - git push origin develop |
312 | | - echo "✅ develop branch synced with main" |
313 | | - else |
| 310 | + if ! git ls-remote --heads origin develop | grep -q develop; then |
314 | 311 | echo "ℹ️ develop branch does not exist, skipping sync" |
| 312 | + exit 0 |
315 | 313 | fi |
| 314 | +
|
| 315 | + # Create sync branch from main |
| 316 | + git checkout -b "$SYNC_BRANCH" |
| 317 | + git push origin "$SYNC_BRANCH" |
| 318 | +
|
| 319 | + # Create PR to merge into develop |
| 320 | + PR_URL=$(gh pr create \ |
| 321 | + --base develop \ |
| 322 | + --head "$SYNC_BRANCH" \ |
| 323 | + --title "Sync develop with main after $VERSION_TAG" \ |
| 324 | + --body "## 🔄 Sync develop with main |
| 325 | +
|
| 326 | + This PR syncs the \`develop\` branch with \`main\` after release **$VERSION_TAG**. |
| 327 | +
|
| 328 | + --- |
| 329 | + *This PR was automatically generated.*") |
| 330 | +
|
| 331 | + echo "✅ Sync PR created: $PR_URL" |
0 commit comments