Skip to content

About

Reusable GitHub Actions workflows for kapi — run the kapi loop and gate content quality from one `uses:` line.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

kapi-workflows

Reusable GitHub Actions workflows for kapi. Each workflow is one uses: line: up.yml runs the kapi loop and opens a pull request, and gate.yml fails a pull request when the project's checks fail. Both use setup-kapi and kapi-action. Use those two directly when you need a different job layout.

up.yml: run the kapi loop and open a pull request

name: Translations
on:
  schedule:
    - cron: "0 6 * * 1-5"
  workflow_dispatch:

jobs:
  up:
    uses: neokapi/kapi-workflows/.github/workflows/up.yml@v1
    permissions:
      contents: write
      pull-requests: write
    secrets:
      bowrain-auth-token: ${{ secrets.BOWRAIN_AUTH_TOKEN }}   # projects connected to a Bowrain server
      # anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}   # or runs on the runner itself

The job runs kapi up and opens a pull request with the new translations and a run report: the outcome, the number of passes, and the languages waiting for review. A run that leaves work waiting for review still delivers what it finished. Set fail-on-parked: true to fail the job instead.

Inputs project, args, create-pull-request (default true), fail-on-parked, plugins (default bowrain), kapi-version, server, runs-on
Secrets bowrain-auth-token, anthropic-api-key, deliver-token
Outputs outcome, passes, parked-locales, has-changes, pull-request-url

A pull request opened with the default GITHUB_TOKEN starts no other workflow. Pass a personal access token or a GitHub App token as deliver-token if CI or a deploy should run on the delivered translations.

What a run does

Each pass handles every language that is below its ship gate, in three steps:

  1. Reuse exact matches from the content memory. This step needs no AI provider.
  2. Translate the rest with the configured AI provider and the project's terms.
  3. Check the output: placeholders, inline codes and terms that must stay untranslated.

A translation with a failing finding counts as a draft, so it does not raise the language's coverage. Passes repeat until every language meets its gate or a pass makes no progress.

Work left for review is the review queue. When a person approves it, the language's reviewed coverage goes up, and the next run and the next gate use the new count. See Review and approve and The kapi loop in CI.

gate.yml: fail a pull request on failing checks

name: Ship gate
on:
  pull_request:
    paths: ["content/**", "src/locales/**"]

jobs:
  ship-gate:
    uses: neokapi/kapi-workflows/.github/workflows/gate.yml@v1
    permissions:
      contents: read
      pull-requests: write

The job runs kapi check --ship. It applies the project's checks (voice, terms and rule-based checks) and its ship and source coverage gates. A failing gate exits with code 3, fails the job with a "gate unmet" annotation, and posts one report comment on the pull request, which later runs update. Target-language coverage fails a build only through this gate, so add it where you want that check.

Inputs project, args (default --ship), plugins, kapi-version, pr-comment (default true), fetch-depth (default 1), server, runs-on
Output gate (pass or fail)

To check only the commits in a pull request, pass --diff-range or --diff-against with fetch-depth: 0, so the job has the commits to compare:

jobs:
  ship-gate:
    uses: neokapi/kapi-workflows/.github/workflows/gate.yml@v1
    with:
      args: "--diff-range ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"
      fetch-depth: 0

Versions

@v1 is a floating major tag. The workflows install kapi 1.4.0 by default. Set kapi-version to pin another release, or to latest for the newest stable release.

License

Apache-2.0. See LICENSE.

About

Reusable GitHub Actions workflows for kapi — run the kapi loop and gate content quality from one `uses:` line.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors