forked from jupyterlab/jupyterlab
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.56 KB
/
check-i18n.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
name: Check internationalization changes
on:
pull_request:
jobs:
check_i18n:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
python -m pip install -U pip jupyterlab-translate~=1.0
- name: Compute hash
id: currentHash
run: |
set -eux
HASH=$(python scripts/i18n_check.py | tail -n1)
echo "::set-output name=i18n::${HASH}"
- name: Checkout target
run: |
echo Checking ${GITHUB_BASE_REF}...
# Ref https://github.com/actions/checkout/issues/93
git fetch --depth=1 origin +refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}
git checkout ${GITHUB_BASE_REF}
- name: Check hash
env:
CURRENT: ${{ steps.currentHash.outputs.i18n }}
run: |
set -eux
EXPECTED=$(python scripts/i18n_check.py | tail -n1)
if [[ "${CURRENT}" != "${EXPECTED}" ]]; then
echo "Translatable strings have changed, this is only allowed on major or minor version bumps."
# Set job status as failed if
# - branch is not "main"
# - and current version is not a pre release of a zeroed patch version
if [[ "${GITHUB_BASE_REF}" != "main" && ! ( $(python setup.py --version) =~ ^[0-9]+\.[0-9]+\.0(\.dev|a|b|rc)[0-9]+$ ) ]]; then
exit 1
fi
fi