diff --git a/.github/workflows/auto-merge-staging-into-main.yml b/.github/workflows/auto-merge-staging-into-main.yml index 848cde2e..f233b3ad 100644 --- a/.github/workflows/auto-merge-staging-into-main.yml +++ b/.github/workflows/auto-merge-staging-into-main.yml @@ -8,8 +8,6 @@ on: jobs: merge: runs-on: ubuntu-latest - outputs: - reason: ${{ steps.check.outputs.reason }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -30,15 +28,9 @@ jobs: id: check run: | git fetch origin - COUNT=$(git rev-list --count origin/staging..origin/main) - if [ "$COUNT" -gt 0 ]; then - echo "reason=ok" >> $GITHUB_OUTPUT + if [ $(git rev-list --count origin/staging..origin/main) -gt 0 ]; then echo "❌ Staging is behind main and requires manual merging." exit 1 - elif [ "$COUNT" -eq 0 ]; then - echo "reason=identical" >> $GITHUB_OUTPUT - echo "✅ Staging and main are identical. Nothing to do." - exit 42 fi - name: Create PR from staging to main @@ -61,7 +53,7 @@ jobs: notify_failure: needs: merge - if: failure() && needs.merge.outputs.reason != 'identical' + if: failure() runs-on: ubuntu-latest steps: - name: Send Discord notification on failure @@ -69,4 +61,16 @@ jobs: 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