name: Auto-Merge to Integration on: push: branches: - 'feature/**' - 'bootstrap' jobs: auto-integrate: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Configure Git run: | git config user.name "CTO Integration Bot" git config user.email "integration@company.com" - name: Auto-merge to INTEGRATION-WIP run: | git checkout INTEGRATION-WIP git pull origin INTEGRATION-WIP BRANCH_NAME="${{ github.ref_name }}" echo "Merging $BRANCH_NAME to INTEGRATION-WIP" if git merge origin/$BRANCH_NAME --no-ff -m "Auto-merge: $BRANCH_NAME to INTEGRATION-WIP for testing Original commit: ${{ github.sha }} Triggered by: ${{ github.event_name }} Author: ${{ github.actor }}"; then git push origin INTEGRATION-WIP echo "✅ Successfully merged $BRANCH_NAME to INTEGRATION-WIP" else echo "❌ Merge conflict detected for $BRANCH_NAME" exit 1 fi - name: Create Integration Status Issue if: failure() uses: actions/github-script@v7 with: script: | github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: `🚨 Integration Failure: ${context.ref_name}`, body: `**Auto-merge to INTEGRATION-WIP failed** **Details:** - Branch: \`${context.ref_name}\` - Commit: \`${context.sha}\` - Author: @${context.actor} - Trigger: ${context.eventName} **Action Required:** 1. Check for merge conflicts in INTEGRATION-WIP 2. Manually resolve conflicts 3. Complete the integration manually **Manual Integration Commands:** \`\`\`bash git checkout INTEGRATION-WIP git pull origin INTEGRATION-WIP git merge origin/${context.ref_name} --no-ff # Resolve conflicts if any git push origin INTEGRATION-WIP \`\`\``, labels: ['integration-failure', 'needs-attention', 'cto-review'] })