Skip to content

Latest commit

 

History

History
88 lines (67 loc) · 2.9 KB

README.md

File metadata and controls

88 lines (67 loc) · 2.9 KB

Gettext updates

This action automates the manual steps needed to regenerate the gettext templates if required

Requirements

This image is intended for use with elementary debian projects. There are a few requirements before getting started:

  1. The project needs to have a deb-packaging branch with the necessary debian packaging for the project. Docs: debian control
  2. The project needs to use the meson build system

Environment Variables

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:

  1. Generate a Personal Access Token from your GitHub user settings
  2. Give it the repo scope
  3. Copy the generated Personal Access Token
  4. In the repo's settings, navigate to the "Secrets" tab and "Add a new secret"
  5. Name the new secret GIT_USER_TOKEN and paste the copied Personal Access Token

Git User

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]"

Specifying a translation branch name

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'

Include the translation template

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'

Examples

Simple Example

name: Gettext updates
on:
  push:
    branches: [ $default-branch ]
jobs:
  gettext_template:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: elementary/actions/gettext-template@main
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Full Example

name: Gettext updates
on:
  push:
    branches: [ $default-branch ]
jobs:
  gettext_template:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: elementary/actions/gettext-template@main
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        translation_branch: 'i18n'
        regenerate_po: 'true'