GitHub Action
github-transifex-actions
Please pin your git action version (List here) instead of using latest
, so that breaking changes do not break your workflow (see bellow) You can also use the version edge
for the current unreleased version (master branch) of this action
- For now it just pushes the source strings to Transifex, as long as you configure the
TX_TOKEN
to the enviroment of the job.
Define a workflow in .github/workflows/transifex.yml
(or add a job if you already have defined workflows).
💡 Read more about Configuring a workflow.
on:
pull_request:
types: [labeled]
name: "Translations Sync"
jobs:
push-strings-to-transifex:
if: github.event.label.name == 'Ready for translations'
name: push-strings-to-transifex
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Run action"
with:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
uses: docker://sergioisidoro/github-transifex-action:v0.2.0
Because you might have multiple branches ongoing, and you might not want to override what the other branch have pushed to transifex, this action offers a solution for handling the diff of transifex remote and the current branch with git.
- It will pull things from transifex remote into a separate branch,
- merge your current branch into the branch with the transifex content (and resolving the diff)
- Push things back to transifex
- Commit the state into your PR
That way you have what's in transifex + all the changes you've made in the current branch. Of course if there are merge conflicts you will need to take manual action.
pull_sources: false
or pull_translations: false
this action will not pull things from transifex. This means that if you use any of the push commands, that action will override transifex content without using the merging functionality of this action. These inputs have default true to prevent accidental overrides.
Here are the most common use cases for this action
NOTE: github_token
and translations_folder
are required if you use git_flow
- name: "Merge and push to transifex"
with: # Or as an environment variable
tx_token: ${{ secrets.TX_TOKEN }}
git_flow: true
github_token: ${{ secrets.GITHUB_TOKEN }}
translations_folder: config/locale
pull_translations: true
pull_sources: true
push_translations: true
push_sources: true
- name: "Pull from transifex and commit to the PR"
with: # Or as an environment variable
tx_token: ${{ secrets.TX_TOKEN }}
git_flow: true
github_token: ${{ secrets.GITHUB_TOKEN }}
translations_folder: config/locale
pull_translations: true
pull_sources: true
commit_to_pr: true
- name: "Reset Transifex with current state"
with: # Or as an environment variable
tx_token: ${{ secrets.TX_TOKEN }}
git_flow: true
github_token: ${{ secrets.GITHUB_TOKEN }}
translations_folder: config/locale
pull_translations: false
pull_sources: false
push_translations: true
push_sources: true
DEPRECATED - This action does not require a git token, or a translation folder input. But it can only push sources and translations without merging the transifex state. It does not support commit to the PR, and push command will override anything in Transifex with the current state of the pull request.
Support for simple workflow will be removed on the next releases.
- name: "Run action"
with: # Or as an environment variable
git_flow: false
tx_token: ${{ secrets.TX_TOKEN }}
push_sources: true
push_translations: true
disable_override: false
See the action input description for a full understanding of what the action supports
As Docker images are automatically built and pushed on a merge to master
or when a new tag is created in this repository, the recommended way to use this GitHub action is to reference the pre-built Docker image directly, as seen above.
💡 The Docker image can also be executed directly by running
$ docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app sergioisidoro/github-transifex-action:latest
For more information, see the Docker Docs: Docker run reference.
Instead of using the latest pre-built Docker image, you can also specify a Docker image tag (which corresponds to the tags released on GitHub):
on:
pull_request:
push:
branches:
- master
tags:
- "**"
name: "Continuous Integration"
jobs:
github-action-template:
name: github-action-template
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Run action"
- uses: docker://sergioisidoro/github-transifex-action:latest
+ uses: docker://sergioisidoro/github-transifex-action:1.2.3
Please have a look at CHANGELOG.md
.
- Passing the resource as an argument
Please have a look at CONTRIBUTING.md
.
Please have a look at CODE_OF_CONDUCT.md
.
This package is licensed using the MIT License.
- @smaisidoro
- @rGaillard