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

Add download_sources option #74

Closed
sazarubin opened this issue Jul 2, 2021 · 4 comments · Fixed by #165
Closed

Add download_sources option #74

sazarubin opened this issue Jul 2, 2021 · 4 comments · Fixed by #165
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@sazarubin
Copy link

Problem
I'm trying to implement workflow, where Crowdin and not the repo is the source of truth both for source strings and translations.
It would go like this:

  1. Developer adds new string using Crowdin UI
  2. Crowdin GitHub action in the translations repo is triggered by cron, adds a new string to repo, opens PR
  3. PR is auto-merged to main branch
  4. Sources from the main branch are used to build TypeScript typing packages and pushed to our registry

But when I add a new string to a source file using Crowdin UI and then GitHub action from (2) triggers, it removes new string from Crowdin instead of adding it to the repo.
I couldn't find an option to download source files from Crowdin, but it exists in Crowdin CLI.

Solution I'd like
It would be convenient and also seems pretty logical and easy to add a download_sources option symmetric to upload_sources. The default value would be false, so it won't surprise or break existing integrations.

I'm not sure if this option would be useful for most Crowdin Action users, but it sure won't harm anyone being off by default, nor would it add much complexity to the action code.

Alternatives I've considered
I could change workflow, but it would harm developer experience, because when developer adds a new string by commiting to repo, he or she would also need to go to UI to add context, screenshot, translations for his/her native languages and so on. So, it seems to me that starting the process from Crowdin UI would be more straightforward.
I also could use Crowdin CLI directly, but I like using this action 😃

I'm glad to send PR if that helps in any way.

@sazarubin sazarubin added the enhancement New feature or request label Jul 2, 2021
@Olena1234
Copy link

Hi there! Thank you for the details, checking them

@andrii-bodnar andrii-bodnar added the good first issue Good for newcomers label Jul 5, 2021
@sazarubin
Copy link
Author

I got it working, but it's not trivial to align commit & push with download_translations behaviour. Currently my version relies on push_translations option to push sources, which isn't obvious at all.

I have some suggestions below on how to make this more obvious, but I certainly underestimated the complexity of such change.

Commit and push options are currently documented and used as download translations options, so I see two ways of setting up download_sources commit and push.

  • Option 1: Create separate commits for sources and translations and use separate options for them: commit_sources, sources_commit_message, commit_translations and translations_commit_message (an alias of commit_message).
  • Option 2: Create a single commit for sources and translations with commit_message and extract commit and push into separate section.

In any case, action would benefit from aliasing push_translations as push and calling push once in the end of the action.

Also, there is a catch in option 1. If I disable commit_sources, but enable commit_translations, I expect the sources not to be commited. To achieve that, we need to stash everything before commiting translations and popping the stash afterwards. If we take it a step further, I would expect that commit_sources also commit nothing but sources, so we need stash && download && stash pop there too.

I hope Crowdin developers have more insight into which alternative would benefit their users more, but after some thought I consider using Crowdin CLI directly because our workflow seem to be too specific for general-purpose action.

@Olena1234
Copy link

Hi there! Glad to hear that you got it working, it looks to us that your current realization is pretty simple and flexible. Regarding your options, the more new parameters would be added, the more complex the GitHub action would be. You may also specify download_sources with commit_message as a one job and download_translations with the different commit_message as another job. In case you would specify download_sources and download_translations in one job, then everything could go to one commit with the common commit_message

@andrii-bodnar
Copy link
Member

Hi @sazarubin!

Is the provided solution above is clear for you? This solution will be flexible and simple

In any case, we can discuss this in more detail 🙂

@andrii-bodnar andrii-bodnar added the hacktoberfest This issue welcomes contributions for Hacktoberfest label Sep 27, 2022
@andrii-bodnar andrii-bodnar removed the hacktoberfest This issue welcomes contributions for Hacktoberfest label Nov 25, 2022
@andrii-bodnar andrii-bodnar linked a pull request Feb 15, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants