-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚚 Prevent Weblate conflicts by locking/unlocking (#5448)
We're still sometimes seeing merge conflicts in Weblate because people are submitting translations in the ~1-2hr window it takes us to merge the update PR. To completely avoid these, we're going to take rough measures: lock the Weblate repo when we start the merge process, and only unlock it after the PR is merged. Because merging a PR is an asynchronous process, this lock/unlock behavior is split over 2 different workflows (`update-weblate.yml` to lock, `unlock-weblate.yml` to unlock). For the cases where there are still conflicts due to manual editing in translated YAMLs, we do the same for the "Resolve conflicts" script: make it work the same as the regular daily update script (lock + make Weblate forget about changes it had that are now in a normalized PR).
- Loading branch information
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Weblate is locked when a daily translations PR is created. Unlock Weblate | ||
# when that PR gets closed (either as merged or rejected). | ||
# | ||
# We do this to avoid conflicts. | ||
name: Unlock Weblate when PR is closed | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
if_merged: | ||
if: | ||
github.event.pull_request.user.login == 'weblate' || | ||
contains(github.event.pull_request.labels.*.name, 'translations') | ||
runs-on: ubuntu-latest | ||
steps: | ||
# These are all the same as in 'update-weblate.yml' | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.12 | ||
- name: Install Weblate Client | ||
run: pip install wlc | ||
- name: Prepare client config | ||
run: | | ||
echo '[weblate]' >> .weblate | ||
echo 'url = https://hosted.weblate.org/api/' >> .weblate | ||
echo 'translation = hedy' >> .weblate | ||
echo '[keys]' >> .weblate | ||
echo 'https://hosted.weblate.org/api/ = ${{ secrets.WEBLATE_API_KEY }}' >> .weblate | ||
- run: | | ||
wlc unlock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters