Skip to content

[ZH-CN] Translations - documentation #1187

[ZH-CN] Translations - documentation

[ZH-CN] Translations - documentation #1187

Workflow file for this run

# Pass/fail checks for continuous integration testing.
# Webhook events: Pull requests
name: CI
on:
pull_request:
paths:
- "site/**"
- "!site/en-snapshot/**"
jobs:
nbfmt:
name: Notebook format
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/checkout@v2
- name: Fetch master branch
run: git fetch -u origin master:master
- name: Install tensorflow-docs
run: python3 -m pip install -U git+https://github.com/tensorflow/docs
- name: Check notebook formatting
run: |
source ./tools/ci/utils.sh
# Get notebooks modified in this pull request (and not deleted).
readarray -t changed_files < <(get_changed_files | grep '\.ipynb$')
if [[ ${#changed_files[@]} == 0 ]]; then
echo "No notebooks modified in this pull request."
exit 0
fi
echo "Check formatting with nbfmt:"
python3 -m tensorflow_docs.tools.nbfmt --test "${changed_files[@]}"
nblint:
name: Notebook lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/checkout@v2
- name: Fetch master branch
run: git fetch -u origin master:master
- name: Install tensorflow-docs
run: python3 -m pip install -U git+https://github.com/tensorflow/docs
- name: Lint notebooks
run: |
source ./tools/ci/utils.sh
readarray -t changed_files < <(get_changed_files | grep '\.ipynb$' | grep -v 'en-snapshot')
if [[ ${#changed_files[@]} == 0 ]]; then
echo "No notebooks modified in this pull request."
exit 0
fi
echo "Lint check with nblint:"
python3 -m tensorflow_docs.tools.nblint \
--styles=tensorflow,tensorflow_docs_l10n \
--arg=repo:tensorflow/docs-l10n "${changed_files[@]}"
sot-check:
name: Source doc check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch master branch
run: git fetch -u origin master:master
- name: Check for source doc
run: |
source ./tools/ci/utils.sh
readarray -t changed_files < <(get_changed_files | grep '\.ipynb$' \
| grep -v 'en-snapshot' | grep -v 'REVIEWERS' | grep -v 'README')
if [[ ${#changed_files[@]} == 0 ]]; then
echo "No docs modified in this pull request."
exit 0
fi
# Check that each file has a counterpart in the site/en-snapshot directory.
declare -a orphan_files
for fp in "${changed_files[@]}"; do
# Get file path relative to translation root.
rel_fp="${fp#site/*/}"
if [[ ! -f "site/en-snapshot/$rel_fp" ]]; then
orphan_files+=("$fp")
fi
done
if [[ ${#orphan_files[@]} != 0 ]]; then
echo "No source counterpart in site/en-snapshot for the following:"
printf -- "- %s\n" "${orphan_files[@]}"
exit 1
fi