forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (110 loc) · 4.8 KB
/
translation-health-report.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Translation health report
# **What it does**: Provides errors and summary statistics on rendering translated content.
# **Why we have it**: To improve our translations by having clearer visibility.
# **Who does it impact**: Docs engineering, Microsoft translators.
on:
workflow_dispatch:
schedule:
- cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST
permissions:
contents: write
jobs:
create-translation-health-report:
name: Create translation health report
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-20.04-xl
# This sets a maximum execution time of 300 minutes (5 hours)
# to prevent the workflow from running longer than necessary.
timeout-minutes: 300
strategy:
fail-fast: false
matrix:
include:
- language: zh
language_dir: translations/zh-cn
language_repo: github/docs-internal.zh-cn
- language: es
language_dir: translations/es-es
language_repo: github/docs-internal.es-es
- language: pt
language_dir: translations/pt-br
language_repo: github/docs-internal.pt-br
- language: ru
language_dir: translations/ru-ru
language_repo: github/docs-internal.ru-ru
- language: ja
language_dir: translations/ja-jp
language_repo: github/docs-internal.ja-jp
- language: fr
language_dir: translations/fr-fr
language_repo: github/docs-internal.fr-fr
- language: de
language_dir: translations/de-de
language_repo: github/docs-internal.de-de
- language: ko
language_dir: translations/ko-kr
language_repo: github/docs-internal.ko-kr
steps:
- name: Checkout the docs-internal repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Checkout the language-specific repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: ${{ matrix.language_repo }}
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
path: ${{ matrix.language_dir }}
- name: Get language SHA
run: |
gitref=$(cd ${{ matrix.language_dir }} && git rev-parse --short HEAD)
echo "gitref=$gitref" >> $GITHUB_ENV
- uses: ./.github/actions/node-npm-setup
- name: Create translation health report
run: |
node script/i18n/create-translation-health-report.js \
--language ${{ matrix.language }} \
--gitref ${{ env.gitref }} \
>> $GITHUB_WORKSPACE/translation-health-report.json
- name: View report in workflow
run: cat $GITHUB_WORKSPACE/translation-health-report.json
- name: Log in to Azure
uses: azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
with:
creds: ${{ secrets.PROD_AZURE_CREDENTIALS }}
# https://learn.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest#az-storage-blob-upload
# https://github.com/marketplace/actions/azure-cli-action
- name: Upload latest to Azure blob storage
uses: azure/CLI@61bb69d64d613b52663984bf12d6bac8fd7b3cc8
with:
inlineScript: |
az storage blob upload \
--name "${{ matrix.language }}-latest.json" \
--file $GITHUB_WORKSPACE/translation-health-report.json \
--account-name githubdocs \
--account-key ${{ secrets.AZURE_GITHUBDOCS_STORAGE_KEY }} \
--container-name translation-health-reports \
--overwrite true
- name: Upload date formatted to Azure blob storage
uses: azure/CLI@61bb69d64d613b52663984bf12d6bac8fd7b3cc8
with:
inlineScript: |
# Write a date formatted for historical reference
az storage blob upload \
--name "${{ matrix.language }}-$(date +%Y-%m-%d).json" \
--file $GITHUB_WORKSPACE/translation-health-report.json \
--account-name githubdocs \
--account-key ${{ secrets.AZURE_GITHUBDOCS_STORAGE_KEY }} \
--container-name translation-health-reports \
--overwrite true
- name: Log out from Azure
if: always()
run: |
az logout
# 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@1d367080235edfa53df415bd8e0bbab480f29bad
if: failure()
with:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
color: failure
text: 'The health report for ${{ matrix.language }} failed.'