codeant-ai-for-open-source[bot] commented on code in PR #45584:
URL: https://github.com/apache/superset/pull/45584#discussion_r4341828320


##########
.github/workflows/sync-translation-catalogs.yml:
##########
@@ -0,0 +1,79 @@
+name: Sync Translation Catalogs
+
+# superset/translations/messages.pot is kept in sync with source by
+# check_pot_drift.py on every PR, but individual locale .po catalogs can
+# drift behind it: a PR that adds a translatable string is only required to
+# regenerate messages.pot, not to propagate the new entries into every
+# language file via `pybabel update`. Nothing else catches that gap -
+# check_translation_regression.py only compares relative counts between a
+# base ref and a PR, so pre-existing drift cancels out on both sides. This
+# job runs the catch-up on a schedule and opens a PR when there's drift to
+# commit, instead of letting it silently accumulate between manual passes.
+on:
+  schedule:
+    - cron: "0 6 * * 1" # Mondays at 06:00 UTC
+  workflow_dispatch: {}
+
+permissions:
+  contents: read
+
+concurrency:
+  group: sync-translation-catalogs
+  cancel-in-progress: false
+
+jobs:
+  sync-translation-catalogs:
+    runs-on: ubuntu-26.04
+    permissions:
+      contents: write
+      pull-requests: write
+    steps:
+      - name: "Checkout master"
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          ref: master
+          persist-credentials: true
+
+      - name: Setup Python
+        uses: $/.github/actions/setup-backend/
+
+      - name: Install gettext tools
+        uses: 
awalsh128/cache-apt-pkgs-action@553a35bb8ebd9fcabcb1c9451aa4c98e1b4ca8a9 # 
v1.6.3
+        with:
+          packages: gettext
+          version: 1.0
+
+      - name: Run babel_update
+        run: ./scripts/translations/babel_update.sh
+
+      - name: Check for drift
+        id: diff
+        run: |
+          if git diff --quiet -- superset/translations; then
+            echo "has_changes=false" >> "$GITHUB_OUTPUT"
+          else
+            echo "has_changes=true" >> "$GITHUB_OUTPUT"
+          fi
+
+      - name: Open or update sync PR
+        if: steps.diff.outputs.has_changes == 'true'
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Review Comment:
   I’d use a narrowly scoped GitHub App installation token, rather than 
dispatching checks explicitly. A token-authenticated push will trigger the 
normal `pull_request` workflows, so the sync PR gets the same required checks 
as a human-opened PR. Explicit dispatches may run jobs, but don’t reliably 
attach the required check statuses to the PR’s head SHA.
   
   One detail: the current checkout persists the default `GITHUB_TOKEN` for 
`git push`. The App token must be used for the checkout/push credentials as 
well as `GH_TOKEN`; changing only `GH_TOKEN` would leave the push using the 
default token. This requires installing/configuring the App with `contents: 
write` and `pull-requests: write`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to