name: Auto Merge Downstream Branches on: push: branches: - production - staging jobs: auto-merge: runs-on: k8s-runner-02 steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 # Required for merging branches - name: Set up Git user run: | git config user.name "Gitea Auto Merge Bot" git config user.email "actions@local.gitea" # 🔹 If push to production, merge to staging - name: Merge production → staging if: gitea.ref == 'refs/heads/production' run: | git fetch origin staging git checkout staging git merge origin/production --no-edit || true git push origin staging # 🔹 If push to staging, merge to development - name: Merge staging → development if: gitea.ref == 'refs/heads/staging' run: | git fetch origin development git checkout development git merge origin/staging --no-edit || true git push origin development