Merge branch 'staging' into dev
This commit is contained in:
@@ -2,7 +2,7 @@ name: Auto Merge Staging into Main
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 2 * * *' # 2:00 UTC = 4:00 CET
|
- cron: '0 2 * * *' # 2:00 UTC = 4:00 Europäische Zeit
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -27,17 +27,29 @@ jobs:
|
|||||||
- name: Check if main has commits not in staging
|
- name: Check if main has commits not in staging
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
if ! git merge-base --is-ancestor origin/staging origin/main; then
|
git fetch origin
|
||||||
echo "Main hat neuere Commits als Staging. Merge wird abgebrochen."
|
if [ $(git rev-list --count origin/staging..origin/main) -gt 0 ]; then
|
||||||
|
echo "❌ Staging is behind main and requires manual merging."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Merge staging into main
|
- name: Create PR from staging to main
|
||||||
if: steps.check.outcome == 'success'
|
id: create_pr
|
||||||
run: |
|
run: |
|
||||||
git checkout main
|
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\`.")
|
||||||
git merge origin/staging --no-ff --no-edit
|
echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
|
||||||
git push origin main
|
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:
|
notify_failure:
|
||||||
needs: merge
|
needs: merge
|
||||||
@@ -50,3 +62,15 @@ jobs:
|
|||||||
-X POST \
|
-X POST \
|
||||||
-d "{\"content\": \"🚨 Auto-Merge fehlgeschlagen! Bitte manuell prüfen: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
|
-d "{\"content\": \"🚨 Auto-Merge fehlgeschlagen! Bitte manuell prüfen: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
|
||||||
${{ secrets.DISCORD_WEBHOOK_URL }}
|
${{ 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 }}
|
||||||
2
.github/workflows/dev-pipeline.yml
vendored
2
.github/workflows/dev-pipeline.yml
vendored
@@ -1,8 +1,6 @@
|
|||||||
name: Development Pipeline
|
name: Development Pipeline
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
branches: [dev]
|
|
||||||
push:
|
push:
|
||||||
branches: [dev]
|
branches: [dev]
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/prevent-wrong-pr.yml
vendored
2
.github/workflows/prevent-wrong-pr.yml
vendored
@@ -9,7 +9,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
check-pr:
|
check-pr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Validate Pull Request Source
|
name: Validate Pull Request Sources
|
||||||
steps:
|
steps:
|
||||||
- name: Prevent dev merges
|
- name: Prevent dev merges
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user