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=$?