From 76bd0bb5dd7072efcb2b9065b0072cab6185775d Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Mon, 28 Apr 2025 17:18:45 -0300 Subject: [PATCH] hilfe --- .../auto-merge-staging-into-main.yml | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/.github/workflows/auto-merge-staging-into-main.yml b/.github/workflows/auto-merge-staging-into-main.yml index cc16f26e..f233b3ad 100644 --- a/.github/workflows/auto-merge-staging-into-main.yml +++ b/.github/workflows/auto-merge-staging-into-main.yml @@ -33,33 +33,22 @@ jobs: exit 1 fi - - name: Checkout staging and create branch - id: create_branch - run: | - git checkout -b auto-merge/staging-to-main origin/staging - git push origin auto-merge/staging-to-main - - - name: Create PR from staging → main + - name: Create PR from staging to main id: create_pr - 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 + run: | + PR_URL=$(gh pr create --base main --head staging --title "Auto-merge staging into main" --body "This PR was created automatically by GitHub Actions. It merges the latest \`staging\` into \`main\`.") + echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT + PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable auto-merge on PR - if: steps.create_pr.outputs.pull-request-number != '' - uses: peter-evans/enable-pull-request-automerge@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} - merge-method: merge + if: steps.create_pr.outputs.PR_NUMBER != '' + run: | + gh pr merge ${{ steps.create_pr.outputs.PR_NUMBER }} --merge --auto + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} notify_failure: