Skip to content

github: Fix weblate action's rights, and update generated code. #1262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/update-translations.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
name: Update translations from Weblate
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "0 10 * * 1"
workflow_dispatch:

jobs:
update-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Fetch and merge from Weblate
# The commit message is generated in Weblate; see https://hosted.weblate.org/addon/17163/
run: |
git remote add weblate https://hosted.weblate.org/git/zulip/zulip-flutter/
git fetch weblate
git merge --ff-only weblate/main
# This may lag behind `main` if weblate is backlogged; this can
# theoretically cause the PR to not be able to auto-merged, though
# re-running the action once weblate has caught up should be
# sufficient to fix that.
git reset --hard weblate/main

- name: Clone Flutter SDK
# We can't do a depth-1 clone, because we need the most recent tag
# so that Flutter knows its version and sees the constraint in our
# pubspec is satisfied. It's uncommon for flutter/flutter to go
# more than 100 commits between tags. Fetch 1000 for good measure.
run: |
git clone --depth=1000 -b main https://github.com/flutter/flutter ~/flutter
TZ=UTC git --git-dir ~/flutter/.git log -1 --format='%h | %ci | %s' --date=iso8601-local
echo ~/flutter/bin >> "$GITHUB_PATH"

# The Flutter tool assumes the tip of tree is "origin/master"
# (or "upstream/master"):
# https://github.com/flutter/flutter/issues/160626
# TODO(upstream): make workaround unneeded
git --git-dir ~/flutter/.git update-ref refs/remotes/origin/master origin/main

- name: Update generated code
run: |
mkdir -p build
tools/check l10n --fix
git add lib/generated/l10n/
GIT_COMMITTER_NAME="Hosted Weblate" GIT_COMMITTER_EMAIL="[email protected]" \
git commit --amend -C HEAD

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
Expand Down