Files
erpnext/.github/workflows/run-hotfix-translation-sync.yml
Diptanil Saha 1ae46b54b2 ci: split sync into orchestrator + per-branch runners, generalise for any app (#55414)
* ci: re-fetch before push to avoid force-push on translations_hotfix

If upstream/translations_hotfix moved forward while the script was
running (e.g., a concurrent run or manual push), git push would fail
with "behind remote". Re-fetch right before pushing and merge any new
remote commits with -X ours so our .po changes and the main.pot from
${HOTFIX_BRANCH} (set by the initial -X theirs merge) are preserved
without needing a force-push.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: define HOTFIX_BRANCH once as job env; pass it to sync script

version-16-hotfix is now declared as env.HOTFIX_BRANCH at the job level
so the checkout ref and the script argument both derive from the same
value. Quoting the GITHUB_WORKSPACE path guards against spaces on
self-hosted runners.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: define HOTFIX_BRANCH as job env and pass to sync script via env

Declares version-16-hotfix once as env.HOTFIX_BRANCH at the job level
so the checkout ref and the script both derive from the same value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: read HOTFIX_BRANCH from env instead of hardcoding in script

Removes the hardcoded branch name from the script; reads it from the
HOTFIX_BRANCH env var set by the workflow. Fails immediately with a
clear message if the var is not set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: use ls-remote to check branch existence instead of swallowing fetch errors

Replace `git fetch ... 2>/dev/null || true` + `git rev-parse --verify`
with `git ls-remote --exit-code --heads upstream translations_hotfix`.
ls-remote queries the remote directly so the check is never based on
stale local state, and real failures (auth, network) propagate through
set -e instead of being silently ignored. Applied to both the initial
branch setup and the pre-push re-fetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: rewrite orchestrator to dispatch runner per hotfix branch via matrix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: add per-branch runner workflow for hotfix translation sync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: generalise sync script to use APP_NAME and GITHUB_REPOSITORY

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: remove push trigger from runner workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: rename working branch to sync_translations_{hotfix_branch}

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 20:13:45 +05:30

53 lines
1.5 KiB
YAML

# Runner — maintain this file on each hotfix branch, not on develop.
#
# Fires when main.pot changes on this branch (i.e. after a POT update PR
# merges), or when dispatched by the orchestrator on develop (weekly schedule).
#
# Uses github.ref_name so the file is identical across all hotfix branches
# with no branch-specific edits required.
name: Run hotfix translation sync
on:
workflow_dispatch:
# One run at a time per branch. cancel-in-progress: false to avoid leaving
# an orphaned remote branch from a mid-flight git push + gh pr create.
concurrency:
group: sync-hotfix-translations-${{ github.ref_name }}
cancel-in-progress: false
jobs:
sync-translations:
name: Sync translations from develop into ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
contents: write
env:
HOTFIX_BRANCH: ${{ github.ref_name }}
APP_NAME: ${{ github.event.repository.name }}
steps:
- name: Checkout ${{ env.HOTFIX_BRANCH }}
uses: actions/checkout@v6
with:
ref: ${{ env.HOTFIX_BRANCH }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
- name: Run sync script
run: |
bash "${GITHUB_WORKSPACE}/.github/helper/sync_hotfix_translations.sh"
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
PR_REVIEWER: diptanilsaha