diff --git a/.github/workflows/auto-merge-staging-into-main.yml b/.github/workflows/auto-merge-staging-into-main.yml deleted file mode 100644 index f233b3ad..00000000 --- a/.github/workflows/auto-merge-staging-into-main.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Auto Merge Staging into Main - -on: - schedule: - - cron: '0 2 * * *' # 2:00 UTC = 4:00 Europäische Zeit - workflow_dispatch: - -jobs: - merge: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set Git user - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Fetch all branches - run: | - git fetch origin main - git fetch origin staging - - - name: Check if main has commits not in staging - id: check - run: | - git fetch origin - if [ $(git rev-list --count origin/staging..origin/main) -gt 0 ]; then - echo "❌ Staging is behind main and requires manual merging." - exit 1 - fi - - - name: Create PR from staging to main - id: create_pr - 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.PR_NUMBER != '' - run: | - gh pr merge ${{ steps.create_pr.outputs.PR_NUMBER }} --merge --auto - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - notify_failure: - needs: merge - if: failure() - runs-on: ubuntu-latest - steps: - - name: Send Discord notification on failure - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d "{\"content\": \"🚨 Auto-Merge fehlgeschlagen! Bitte manuell prüfen: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \ - ${{ secrets.DISCORD_WEBHOOK_URL }} - - notify_success: - needs: merge - if: success() - runs-on: ubuntu-latest - steps: - - name: Send Discord notification on success - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d "{\"content\": \"✅ Auto-Merge ausgeführt! Ergebnis jetzt auf [GitHub](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) und [online-energieausweis.org](https://online-energieausweis.org) einsehen.\"}" \ - ${{ secrets.DISCORD_WEBHOOK_URL }} \ No newline at end of file