python / python-docs-zh-cn

zh_CN translation of the Python documentation
https://docs.python.org/zh-cn/
431 stars 74 forks source link

idea: add 'set -u' for build.sh and update.sh #335

Closed rffontenelle closed 10 months ago

rffontenelle commented 10 months ago

They both have set -ex. Considering that they rely on the environment variable $LOCALE, how about adding set -u as well to error in case $LOCALE is not set at running time? i believe it is a fairly good safety resource.

Dumeng commented 10 months ago

Actually, we set the env var in the below workflow template. So, it should be fine in the GitHub Action environments. https://github.com/python/python-docs-zh-cn/blob/12fad780e73dc3fc3e5fcf326ffde2241b4b5561/.github/workflows/sync.yml#L20

But I agree it might be a problem if someone forked the scripts or ran them in local environments. A PR is welcome.

rffontenelle commented 10 months ago

Yeah, I notice you've got it covered. My suggestion is really more an extra precaution. PR sent.