Multilingual Docs Download workflow (Pycord-Development/pycord)
The Multilingual Docs Download workflow from Pycord-Development/pycord, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Multilingual Docs Download workflow from the Pycord-Development/pycord repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: "Multilingual Docs Download"
on:
workflow_dispatch:
permissions: write-all
jobs:
download:
name: "Download localizations from Crowdin"
runs-on: ubuntu-latest
environment: translations
outputs:
pr_ref: ${{ steps.convert_outputs.outputs.pr_ref }}
pr_id: ${{ steps.convert_outputs.outputs.pr_id }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-tags: true
- name: "Install Python"
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.14"
cache: "pip"
cache-dependency-path: "requirements/_locale.txt"
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/_locale.txt
pip install .[speed,voice,docs]
- name: "Get locales"
run: |
make html
sphinx-build -b gettext . ./build/locales
working-directory: ./docs
- name: "Build locales"
run:
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
working-directory: ./docs
- name: "Crowdin"
id: crowdin
uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2.16.3
with:
upload_sources: false
upload_translations: false
download_translations: false
download_bundle: ${{ vars.CROWDIN_BUNDLE_ID }}
localization_branch_name: ${{ vars.CROWDIN_LOCALIZATION_BRANCH }}
create_pull_request: true
pull_request_title: ${{ vars.CROWDIN_PR_TITLE }}
pull_request_body: ${{ vars.CROWDIN_PR_BODY }}
pull_request_base_branch_name: "master"
pull_request_reviewers: "Lulalaby"
config: "crowdin.yml"
base_path: "."
commit_message: ${{ vars.CROWDIN_COMMIT_MSG }}
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
- name: "Convert Outputs"
id: convert_outputs
run: |
PR_REF="l10n_master"
PR_ID="${{ steps.crowdin.outputs.pull_request_number }}"
echo "pr_ref=$(echo -n "$PR_REF" | base64)" >> $GITHUB_OUTPUT
echo "pr_id=$(echo -n "$PR_ID" | base64)" >> $GITHUB_OUTPUT
pr:
name: "PR operations"
needs: [ download ]
runs-on: ubuntu-latest
environment: translations
steps:
- name: "Checkout Repository"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: "Refresh Pull"
run: |
git fetch --all
git reset --hard origin/master
git pull
- name: "Convert Outputs"
id: convert_outputs
run: |
PR_REF=$(echo -n "${{ needs.download.outputs.pr_ref }}" | base64 --decode)
PR_ID=$(echo -n "${{ needs.download.outputs.pr_id }}" | base64 --decode)
echo "pr_ref=$PR_REF" >> $GITHUB_OUTPUT
echo "pr_id=$PR_ID" >> $GITHUB_OUTPUT
#- name: Invoke checks workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: check.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
#- name: Invoke codeql workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: codeql-analysis.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
#- name: Invoke lint workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: lint.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
#- name: Invoke pr workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: pr.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
#- name: Invoke test workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: test.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
#- name: Invoke todo workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: todo.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
#- name: Invoke version updates workflow
#uses: benc-uk/workflow-dispatch@v1.2.4
#with:
#workflow: version-updates.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: "Auto Approve"
run: gh pr review --approve -b "Auto-approval for localization sync" "$PR_ID"
env:
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Enable Auto Merge"
if: ${{ always() }}
run: gh pr merge --auto --squash $PR_ID
env:
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: "Multilingual Docs Download" on: workflow_dispatch: permissions: write-all jobs: download: timeout-minutes: 30 name: "Download localizations from Crowdin" runs-on: latchkey-small environment: translations outputs: pr_ref: ${{ steps.convert_outputs.outputs.pr_ref }} pr_id: ${{ steps.convert_outputs.outputs.pr_id }} steps: - name: "Checkout Repository" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-tags: true - name: "Install Python" uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: "3.14" cache: "pip" cache-dependency-path: "requirements/_locale.txt" - name: "Install Dependencies" run: | python -m pip install --upgrade pip setuptools wheel pip install -r requirements/_locale.txt pip install .[speed,voice,docs] - name: "Get locales" run: | make html sphinx-build -b gettext . ./build/locales working-directory: ./docs - name: "Build locales" run: sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }} working-directory: ./docs - name: "Crowdin" id: crowdin uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2.16.3 with: upload_sources: false upload_translations: false download_translations: false download_bundle: ${{ vars.CROWDIN_BUNDLE_ID }} localization_branch_name: ${{ vars.CROWDIN_LOCALIZATION_BRANCH }} create_pull_request: true pull_request_title: ${{ vars.CROWDIN_PR_TITLE }} pull_request_body: ${{ vars.CROWDIN_PR_BODY }} pull_request_base_branch_name: "master" pull_request_reviewers: "Lulalaby" config: "crowdin.yml" base_path: "." commit_message: ${{ vars.CROWDIN_COMMIT_MSG }} env: GITHUB_TOKEN: ${{ secrets.CI_TOKEN }} CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }} CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} - name: "Convert Outputs" id: convert_outputs run: | PR_REF="l10n_master" PR_ID="${{ steps.crowdin.outputs.pull_request_number }}" echo "pr_ref=$(echo -n "$PR_REF" | base64)" >> $GITHUB_OUTPUT echo "pr_id=$(echo -n "$PR_ID" | base64)" >> $GITHUB_OUTPUT pr: timeout-minutes: 30 name: "PR operations" needs: [ download ] runs-on: latchkey-small environment: translations steps: - name: "Checkout Repository" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: "Refresh Pull" run: | git fetch --all git reset --hard origin/master git pull - name: "Convert Outputs" id: convert_outputs run: | PR_REF=$(echo -n "${{ needs.download.outputs.pr_ref }}" | base64 --decode) PR_ID=$(echo -n "${{ needs.download.outputs.pr_id }}" | base64 --decode) echo "pr_ref=$PR_REF" >> $GITHUB_OUTPUT echo "pr_id=$PR_ID" >> $GITHUB_OUTPUT #- name: Invoke checks workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: check.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} #- name: Invoke codeql workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: codeql-analysis.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} #- name: Invoke lint workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: lint.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} #- name: Invoke pr workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: pr.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} #- name: Invoke test workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: test.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} #- name: Invoke todo workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: todo.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} #- name: Invoke version updates workflow #uses: benc-uk/workflow-dispatch@v1.2.4 #with: #workflow: version-updates.yml #ref: ${{ steps.convert_outputs.outputs.pr_ref }} - name: "Auto Approve" run: gh pr review --approve -b "Auto-approval for localization sync" "$PR_ID" env: PR_ID: ${{ steps.convert_outputs.outputs.pr_id }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "Enable Auto Merge" if: ${{ always() }} run: gh pr merge --auto --squash $PR_ID env: PR_ID: ${{ steps.convert_outputs.outputs.pr_id }} GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.