Skip to content
Open
72 changes: 72 additions & 0 deletions .github/workflows/mobile-i18n-autofill-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Mobile i18n Autofill (bot PR)

on:
pull_request:
branches: [dev]
paths:
- 'cmp-android/**'
- 'feature/**'
- '.github/workflows/mobile-i18n-autofill-pr.yml'
- 'translate.py'

permissions:
contents: write
pull-requests: write
Comment thread
coderabbitai[bot] marked this conversation as resolved.

jobs:
i18n-autofill:
runs-on: ubuntu-latest

Comment thread
markrizkalla marked this conversation as resolved.
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install google-genai lxml

- name: Run translation autofill
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
python translate.py \
--mode apply \
--locales "ar,bn,de,en,es,fa,fr,gu,hi,hu,id,km,kn,ml,mr,ms,my,pl,pt,ru,si,sw,te,ur" \
--model "gemma-3-27b-it" \
--batch-size 15

- name: Validate Android resources compile
run: |
./gradlew :cmp-android:processDemoDebugResources

- name: Commit and Push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

git add cmp-android/ feature/

if ! git diff --cached --quiet; then
git commit -m "chore: auto-generate mobile i18n translations"
# Since we checked out the fork, 'origin' is now the fork repo.
git push origin HEAD:${{ github.event.pull_request.head.ref }}
else
echo "No changes to commit."
fi
Comment on lines +35 to +100
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Workflow violates repository standard for reusable workflows.

This job is implemented inline, but workflow files in this repo must delegate to reusable workflows from openMF/mifos-x-actionhub@v1.0.8.

As per coding guidelines .github/workflows/*.{yml,yaml}: Configure GitHub Actions workflows to use reusable workflows from openMF/mifos-x-actionhub@v1.0.8.

🧰 Tools
🪛 actionlint (1.7.11)

[error] 89-89: "github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details

(expression)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/mobile-i18n-autofill-pr.yml around lines 35 - 100, The
i18n-autofill job is implemented inline but must be converted to call the
reusable workflow from openMF/mifos-x-actionhub@v1.0.8; replace the inline job
named i18n-autofill with a single uses: openMF/mifos-x-actionhub@v1.0.8 entry
(keeping the job-level if and runs-on as supported) and map the current
env/inputs (LOCALES, MODEL, BATCH_SIZE, REPO_ROOT, GEMINI_API_KEY) into the
reusable workflow's with: inputs, and remove the inline steps (Checkout
repository, Set up JDK 21, Set up Python 3.11, Install Python dependencies, Run
translation autofill, Validate Android resources compile, Commit and Push
changes) so that those actions are executed by the reused workflow; ensure input
names in the with: block correspond to the reusable workflow's expected input
keys and preserve the same default values from the current env section.

Loading
Loading