Skip to content
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

feat(ci): unused translations auto cleanup #13444

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

martykan
Copy link
Member

Description

Adds a --cleanup option to the translations:list-unused script, which automatically removes the unused messages from the file.

The script also includes a --pr option, which will create a new branch with this change and submit a PR.

This can be run from a new workflow in GitHub actions. The workflow is triggered manually to prevent too many PRs being created.

@martykan martykan force-pushed the feat/unused-translations-auto-cleanup branch 3 times, most recently from 3187f48 to a0138aa Compare July 22, 2024 08:42
@martykan martykan marked this pull request as ready for review July 22, 2024 08:42
name: "[Check] remove unused messages and create PR"

on:
workflow_dispatch:
Copy link
Contributor

Choose a reason for hiding this comment

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

@karliatto would you please take over this PR and incorporate into as a nightly check similarly to what you are doing now?

Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to add another action? You're also not using some naming convention for the file. We can add it to the same action but just add a trigger that checks if the action was scheduled to run to only do this instead of updating it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's originally part of [test] misc which runs nightly, but I didn't set that up to automatically create PRs, since it could potentially create duplicate PRs if the first one is not merged right away.
Also I have another idea - maybe this could happen as a part of Crowdin sync?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, doing this every time you sync crowdin seems a bit better to me. 👍

Copy link
Member

Choose a reason for hiding this comment

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

So what is the final idea? will it be run with the Crowding sync or with this workflow as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add it to the Crowdin sync. It should run before the upload to Crowdin.

Copy link
Member Author

Choose a reason for hiding this comment

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

The upload also deletes from Crowdin? I'm just thinking whether it would be dangerous if someone ran it without checking the unused strings prior

Copy link
Contributor

Choose a reason for hiding this comment

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

If a key does not exist in messages.ts, Crowdin sync deletes it from Crowdin and the translation JSONs. Can there be false positives from the script removing unused messages? If so, it has to be run separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

Most likely not, except for the possibility of dynamic strings that are not marked as such.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a checkbox as an input to confirm removing to make it safer

@martykan martykan force-pushed the feat/unused-translations-auto-cleanup branch 2 times, most recently from 5d8d546 to 8312818 Compare July 22, 2024 14:20
@martykan martykan force-pushed the feat/unused-translations-auto-cleanup branch from 8312818 to 42d3835 Compare July 22, 2024 15:08
@martykan martykan merged commit 9a1a5a6 into develop Jul 23, 2024
25 checks passed
@martykan martykan deleted the feat/unused-translations-auto-cleanup branch July 23, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants