diff --git a/.github/workflows/auto-merge-staging-into-main.yml b/.github/workflows/auto-merge-staging-into-main.yml index 963f6d80..1598cd7b 100644 --- a/.github/workflows/auto-merge-staging-into-main.yml +++ b/.github/workflows/auto-merge-staging-into-main.yml @@ -29,25 +29,36 @@ jobs: run: | git fetch origin if [ $(git rev-list --count origin/staging..origin/main) -gt 0 ]; then - echo "❌ Staging ist hinter Main und benötigt ein Merge." + echo "❌ Staging is behind main and requires manual merging." exit 1 fi - - name: Create or update PR from staging → main - if: steps.check.outcome == 'success' - id: cpr - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "chore: auto-merge staging into main" - branch: auto-merge/staging-to-main - base: main - title: "Auto-merge staging into main" - body: | - This PR was created automatically by GitHub Actions. - It merges the latest `staging` into `main`. - draft: false - + - name: Create or update PR from staging → main + if: steps.check.outcome == 'success' + id: cpr + run: | + # Checkout staging branch + git checkout staging + + # Create a new branch for the PR + git checkout -b auto-merge/staging-to-main + + # Push the new branch to the remote + git push origin auto-merge/staging-to-main + + # Create the pull request using the GitHub Action + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: auto-merge staging into main" + branch: auto-merge/staging-to-main + base: main + title: "Auto-merge staging into main" + body: | + This PR was created automatically by GitHub Actions. + It merges the latest `staging` into `main`. + draft: false + - name: Enable auto-merge on PR if: steps.cpr.outputs.pull-request-number != '' uses: peter-evans/enable-pull-request-automerge@v3