Crowdin Sync #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Crowdin Sync | |
# **What it does**: | |
# **Why we have it**: | |
# **Who does it impact**: Docs localization. | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '33 2 * * *' # every day at 2:33 UTC at least until automerge is working | |
jobs: | |
sync_with_crowdin: | |
name: Sync with Crowdin | |
if: github.repository == 'github/docs-internal' | |
runs-on: ubuntu-latest | |
# A sync's average run time is ~3.2 hours. | |
# This sets a maximum execution time of 300 minutes (5 hours) to prevent the workflow from running longer than necessary. | |
timeout-minutes: 300 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@1e204e9a9253d643386038d443f96446fa156a97 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Remove unwanted git hooks | |
run: rm .git/hooks/post-checkout | |
- name: Remove all translations | |
run: | | |
git rm -rf --quiet translations/*/content | |
git rm -rf --quiet translations/*/data | |
- name: Sync | |
uses: crowdin/github-action@d0622816ed4f4744db27d04374b2cef6867f7bed | |
with: | |
# This option enables the transfer of existing translations in this project to Crowdin. | |
# We explicitly set this to `false` since we only want to use the downloaded translations managed by Crowdin. | |
upload_translations: false | |
download_translations: true | |
create_pull_request: true | |
# Using a custom config temporarily to avoid clobbering the existing crowdin.yml | |
# that is used by the github-help-docs OAuth integration. | |
config: 'crowdin.yml' | |
# This is the name of the git branch that Crowdin will create when opening a pull request. | |
# This branch does NOT need to be manually created. It will be created automatically by the action. | |
localization_branch_name: translations | |
# This is the name of the top-level directory that Crowdin will use for files. | |
# Note that this is not a "branch" in the git sense, but more like a top-level directory in your Crowdin project. | |
# This branch does NOT need to be manually created. It will be created automatically by the action. | |
crowdin_branch_name: main | |
env: | |
# Using an @octoglot token instead of the default Actions-provided GITHUB_TOKEN here | |
# so that subsequent workflows will be able to run on the pull request created by this workflow. | |
GITHUB_TOKEN: ${{ secrets.OCTOGLOT_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} | |
# This is a numeric id, not to be confused with Crowdin API v1 "project identifier" string | |
# See "API v2" on https://crowdin.com/project/<your-project>/settings#api | |
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
# A personal access token, not to be confused with Crowdin API v1 "API key" | |
# See https://crowdin.com/settings#api-key to generate a token | |
# This token was created by logging into Crowdin with the octoglot user | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
# When the maximum execution time is reached for this job, Actions cancels the workflow run. | |
# This emits a notification for the first responder to triage. | |
- name: Send Slack notification if workflow is cancelled | |
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 | |
if: cancelled() | |
with: | |
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} | |
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }} | |
color: failure | |
text: The last Crowdin Sync run for ${{github.repository}} was cancelled. Please try running the workflow manually; see https://github.com/${{github.repository}}/actions/workflows/crowdin.yml | |
# Emit a notification for the first responder to triage if the workflow failed. | |
- name: Send Slack notification if workflow failed | |
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 | |
if: failure() | |
with: | |
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} | |
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }} | |
color: failure | |
text: The last Crowdin Sync run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/crowdin.yml |