From ab47c079b13ee2d48fbfaf3555084208ea22f0c7 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar <29282228+andrii-bodnar@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:44:25 +0200 Subject: [PATCH] fix: push Git LFS objects before pushing the localization branch `git push --no-verify` skips the Git LFS pre-push hook, so translation files tracked by LFS were committed as pointers without their objects being uploaded, and GitHub rejected the push with GH008. Run `git lfs push` explicitly when the commit contains LFS files. Closes #323 Co-Authored-By: Claude Opus 5.5 --- docs/EXAMPLES.md | 23 +++++++++++++++++++++++ entrypoint.sh | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 7453555..0fbd88b 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -12,6 +12,7 @@ - [Custom `crowdin.yml` file location](#custom-crowdinyml-file-location) - [Separate PRs for each target language](#separate-prs-for-each-target-language) - [Checking out multiple branches in a single workflow](#checking-out-multiple-branches-in-a-single-workflow) +- [Repositories with Git LFS](#repositories-with-git-lfs) - [Outputs](#outputs) - [`pull_request_url`, `pull_request_number`](#pull_request_url-pull_request_number) - [Triggers](#triggers) @@ -457,6 +458,28 @@ jobs: CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} ``` +### Repositories with Git LFS + +If your source or translation files are tracked with [Git LFS](https://git-lfs.com/), enable LFS in the checkout step. The action then stores the downloaded translations as LFS objects and uploads them before pushing the localization branch: + +```yml +steps: + - uses: actions/checkout@v7 + with: + lfs: true + + - name: Synchronize with Crowdin + uses: crowdin/github-action@v3 + with: + download_translations: true + localization_branch_name: l10n_crowdin_translations + create_pull_request: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} +``` + ## Triggers ### Cron schedule diff --git a/entrypoint.sh b/entrypoint.sh index 438ccde..717d4f6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -307,6 +307,12 @@ push_to_branch() { set +e git commit --no-verify -m "${INPUT_COMMIT_MESSAGE}" RESULT=$? + # --no-verify skips the Git LFS pre-push hook, so upload LFS objects explicitly + if [ "${RESULT}" -eq 0 ] && [ -n "$(git lfs ls-files 2>/dev/null)" ]; then + echo "PUSH GIT LFS OBJECTS" + git lfs push "${REPO_URL}" "${BRANCH}" + RESULT=$? + fi if [ "${RESULT}" -eq 0 ]; then git push --no-verify --force "${REPO_URL}" RESULT=$?