Skip to content

Add gh workflow for creating translations PR #772

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 2 commits into from
Sep 13, 2024

Conversation

steppi
Copy link
Contributor

@steppi steppi commented Aug 31, 2024

Brief description of what is fixed or changed

This PR adds a GitHub workflow for creating a pull request to add or update translations for a given language. It has a workflow_dispatch which accepts a Crowdin language code. The workflow clones the numpy.org repo, ensures that there are no merge conflicts between the translation branch l10n_main and main, checks out l10n_main and then does a scripted interactive rebase onto main which picks only commits for the language of interest. It uses scripts from the repo https://github.com/Scientific-Python-Translations/automations, primarily create_branch_for_language.sh to accomplish it's work.

I've been testing this out on my fork, and have verified that it works there. See https://github.com/steppi/numpy.org/actions/runs/10646298865/job/29512984917, and steppi#6 for an instance of a PR generated by this workflow.

The goal here is to make it easier to create pull requests to add translations, moving something that was a bespoke thing I did on my local machine, to a push button thing anyone with the right permissions can do.

For this to work as is, the GITHUB_TOKEN needs to be given write permissions and permission to create pull requests in the actions settings, if it doesn't already have these permissions.

image

cc @melissawm

Copy link

netlify bot commented Aug 31, 2024

Deploy Preview for numpy-org ready!

Name Link
🔨 Latest commit db819c7
🔍 Latest deploy log https://app.netlify.com/sites/numpy-org/deploys/66d33b8c3c3e340008666666
😎 Deploy Preview https://deploy-preview-772--numpy-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@steppi
Copy link
Contributor Author

steppi commented Aug 31, 2024

Would it be better for the workflow to make the PR from a branch on a scientific-python-translations/numpy.org fork, rather than a branch onnumpy/numpy.org directly?

Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

Sorry for the delay @steppi - this looks fine to me but I'd love to see an example of a crowdin commit so I can wrap my head around the language codes and branches. Do you have that handy?

Oops didn't read the description closely enough 😄

@melissawm
Copy link
Member

Would it be better for the workflow to make the PR from a branch on a scientific-python-translations/numpy.org fork, rather than a branch onnumpy/numpy.org directly?

My gut feeling is that this would increase the chances of something getting out of sync, no?

@steppi
Copy link
Contributor Author

steppi commented Sep 13, 2024

Thanks @melissawm for taking a look!

I'm going to go ahead and merge this. I guess a new workflow which can only be triggered manually through a workflow dispatch by a maintainer can't be too harmful. At worst, I imagine it just might not work due to some difference in the configuration here verse on my fork.

@steppi steppi merged commit b210a3f into numpy:main Sep 13, 2024
4 checks passed
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.

2 participants