This action automates the manual steps needed to regenerate the gettext templates if required
This image is intended for use with elementary debian projects. There are a few requirements before getting started:
- The project needs to have a deb-packaging branch with the necessary debian packaging for the project
- The project needs to use the meson build system
In order to create tags and push changes to various branches, the script needs a GitHub token. When using GitHub workflows, the virtual environment automatically comes with a generated GitHub token secret. However, if your translation branch is protected, you will need to use a Personal Access Token with the repo
scope, generated by a user who has admin permissions for the repo. To do so:
- Generate a Personal Access Token from your GitHub user settings
- Give it the
repo
scope - Copy the generated Personal Access Token
- In the repo's settings, navigate to the "Secrets" tab and "Add a new secret"
- Name the new secret
GIT_USER_TOKEN
and paste the copied Personal Access Token
Instead of using the default GitHub token (GITHUB_TOKEN
), you can use a custom Personal Access Token with the GIT_USER_TOKEN
environment variable. You can also use the following environment variables to set the git user and email:
env:
GIT_USER_TOKEN: "${{ secrets.GIT_USER_TOKEN }}"
GIT_USER_NAME: "example-user"
GIT_USER_EMAIL: "[email protected]"
By default, this action will use the default configured branch to to push the changes. The branch name can be forced via the translation_branch
input. Example:
with:
translation_branch: 'i18n'
By default, this action will only rebuild the translation template. It is also possible to include the language by setting the regenerate_po
input to true. Example:
with:
regenerate_po: 'true'
name: Gettext updates
on:
push:
branches: [ $default-branch ]
jobs:
gettext_template:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: elementary/actions/gettext-template@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Gettext updates
on:
push:
branches: [ $default-branch ]
jobs:
gettext_template:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: elementary/actions/gettext-template@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
translation_branch: 'i18n'
regenerate_po: 'true'