Page MenuHomePhabricator

Option to open a pull request on Github when exporting translations
Closed, ResolvedPublic

Description

Currently when we export translations, we have the ability to push it to a separate branch. Some projects have requested translatewiki to open a PR from that branch to the master branch for more visibility.

Related: T235103: Translation updates failing due to protected branches on Github

Event Timeline

Nemo_bis renamed this task from Open a PR on Github when exporting translations to Option to open a pull request on Github when exporting translations.Feb 5 2020, 9:02 PM
Nemo_bis added a subscriber: Nemo_bis.

For those tuning in now: the reason we don't (normally) want to do this is continuous translation.

I envision this would be used as a part of the following ideal workflow:

  • repong pushes to a non-main branch on the remote (already supported with push-branch config).
  • repong initiates a pull request from the changes
  • automatic CI is run by GitHub/GitLab
  • pull request is automatically accepted and merged if tests pass (not yet clear which code does/will do this)

I found what looks like a reasonably maintained php wrapper around the GitHub API: https://github.com/KnpLabs/php-github-api

I wrote <50 line proof of concept using the above mentioned library:

developer@dev:~/translatewiki/repong (master)$ php pull.php 
Authenticating
Creating a pull request
Pull request already exists, checking status...
Pull request has been open for 0 days and 0 hours and 19 minutes

Should be relatively simple to integrate this to the repong script. Main things to consider:

  • How to secure access to the access token for the API
  • How to express pull-request mode in repoconfig.yaml

Change 578950 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[translatewiki@master] repong: Add support for pull requests

https://gerrit.wikimedia.org/r/578950

Change 578950 merged by jenkins-bot:
[translatewiki@master] repong: Add support for pull requests

https://gerrit.wikimedia.org/r/578950

Not sure which column is best for this, but the plan is to start using this on a first project soon, and close if no issues noticed there in, for example, 7 days.

I've added support for creating PR for the Bitmark Spring mobile apps. We can test this after the related patch is deployed, and exports are run tomorrow, Monday and next Thursday. Moving this to recheck after deployment.

Change 587784 had a related patch set uploaded (by Abijeet Patro; owner: Nikerabbit):
[translatewiki@master] GithubClient: Fix head parameter in getPullRequestCreationTime

https://gerrit.wikimedia.org/r/587784

Change 587784 merged by jenkins-bot:
[translatewiki@master] GithubClient: Fix head parameter in getPullRequestCreationTime

https://gerrit.wikimedia.org/r/587784