Skip to content

Back-merge main into develop #25

Back-merge main into develop

Back-merge main into develop #25

name: Back-merge main into develop
# back-merge-main-to-develop.yaml
#
# Purpose: After CI release-chore commits land on main (sync-packaging-version,
# readme stats, metainfo/debian regeneration, Crowdin), automatically merge
# main back into develop so the two branches never drift apart again.
#
# Trigger model:
# - workflow_run: catches the chore workflows that push via GITHUB_TOKEN.
# GitHub's "on: push" is NOT retriggered for GITHUB_TOKEN-authored pushes,
# so we watch for those workflow runs completing instead.
# - schedule (hourly): catch-all safety net for any drift source not enumerated
# above (e.g. direct pushes from tools or future CI jobs not listed here).
# - push: branches: [main]: covers human pushes promptly; harmless for
# GITHUB_TOKEN-authored pushes (those are silently skipped by GitHub).
# - workflow_dispatch: allows a manual run at any time.
#
# Loop safety: GITHUB_TOKEN-authored pushes do NOT retrigger workflow runs, so
# this job pushing to develop will never kick off another instance of itself.
on:
workflow_run:
workflows:
- "Sync packaging version"
- "Update README stats"
- "Create GitHub Release"
- "Crowdin Sync"
types:
- completed
# Catch-all safety net: runs hourly to catch any drift source not covered
# by the workflow_run triggers above (offset to avoid top-of-hour rush).
schedule:
- cron: '17 * * * *'
workflow_dispatch:
push:
branches:
- main
# Queue runs rather than cancel them, so back-merges land in order.
concurrency:
group: back-merge-develop
cancel-in-progress: false
permissions:
contents: write
jobs:
back-merge:
runs-on: ubuntu-latest
steps:
- name: Checkout develop
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
# Default GITHUB_TOKEN is fine; its pushes do not retrigger workflows.
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Merge main into develop and push
run: |
git fetch origin main
if git merge --no-edit --no-ff origin/main; then
# Merge succeeded — check whether there is actually anything new to push.
if git diff --quiet origin/develop..HEAD; then
echo "develop already up to date with main — nothing to push."
else
git push origin develop
fi
else
echo "::error::Automatic back-merge of main into develop hit a conflict — resolve manually."
git merge --abort || true
exit 1
fi