only git status on push command (#22043)
* Fix extract locales in CI - reset current git config values after pushing - only use git commands in push script - fix typo in CI config * Commit with flags instead of seting global configs.
This commit is contained in:
Родитель
487e284f5c
Коммит
110b0bc907
|
@ -30,7 +30,7 @@ jobs:
|
|||
make update_deps
|
||||
make extract_locales
|
||||
|
||||
- name: Push Lcoales (dry-run)
|
||||
- name: Push Locales (dry-run)
|
||||
if: github.event_name == 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
|
|
|
@ -15,6 +15,7 @@ ROBOT_NAME="Mozilla Add-ons Robot"
|
|||
DATE=$(date -u +%Y-%m-%d)
|
||||
REV=$(git rev-parse --short HEAD)
|
||||
MESSAGE="Extracted l10n messages from $DATE at $REV"
|
||||
DIFF_WITH_ONE_LINE_CHANGE="2 files changed, 2 insertions(+), 2 deletions(-)"
|
||||
|
||||
DRY_RUN=true
|
||||
|
||||
|
@ -22,24 +23,24 @@ if [[ "${1:-}" != "--dry-run" ]]; then
|
|||
DRY_RUN=false
|
||||
fi
|
||||
|
||||
git_diff_stat=$(git diff --shortstat locale/templates/LC_MESSAGES)
|
||||
|
||||
echo "git_diff_stat: $git_diff_stat"
|
||||
|
||||
# IF there are no uncommitted local changes, exit early.
|
||||
if [[ -z "$(git status --porcelain)" ]]; then
|
||||
if [[ -z "$git_diff_stat" ]] || [[ "$git_diff_stat" == *"$DIFF_WITH_ONE_LINE_CHANGE"* ]]; then
|
||||
echo """
|
||||
There are no uncommited changes in the working directory.
|
||||
Run make extract_locales to extract the locales first.
|
||||
No substantial changes to l10n strings found. Exiting the process.
|
||||
"""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $DRY_RUN == true ]]; then
|
||||
echo "Dry running..."
|
||||
echo "git config --global user.name \"$ROBOT_NAME\""
|
||||
echo "git config --global user.email \"$ROBOT_EMAIL\""
|
||||
echo "git commit -a -m \"$MESSAGE\""
|
||||
echo "git commit --author=\"$ROBOT_NAME <$ROBOT_EMAIL>\" -a -m \"$MESSAGE\""
|
||||
echo "git push"
|
||||
else
|
||||
git config --global user.name "$ROBOT_NAME"
|
||||
git config --global user.email "$ROBOT_EMAIL"
|
||||
git commit -a -m "$MESSAGE"
|
||||
# Commit the changes and push them to the repository.
|
||||
git commit --author="$ROBOT_NAME <$ROBOT_EMAIL>" -a -m "$MESSAGE"
|
||||
git push
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,6 @@ DJANGO_SETTINGS_MODULE=settings
|
|||
CLEAN_FLAGS="--no-obsolete --width=200 --no-location"
|
||||
MERGE_FLAGS="--update --width=200 --backup=none --no-fuzzy-matching"
|
||||
UNIQ_FLAGS="--width=200"
|
||||
DIFF_WITH_ONE_LINE_CHANGE="2 files changed, 2 insertions(+), 2 deletions(-)"
|
||||
LOCALE_TEMPLATE_DIR="locale/templates/LC_MESSAGES"
|
||||
|
||||
info() {
|
||||
|
@ -40,16 +39,6 @@ PYTHONPATH=. DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} pybabel extract -F
|
|||
|
||||
pushd locale > /dev/null
|
||||
|
||||
git_diff_stat=$(git diff --shortstat)
|
||||
|
||||
echo "git_diff_stat: $git_diff_stat"
|
||||
|
||||
# IF there are no uncommitted local changes, exit early.
|
||||
if [[ -z "$git_diff_stat" ]] || [[ "$git_diff_stat" == *"$DIFF_WITH_ONE_LINE_CHANGE"* ]]; then
|
||||
info "No changes to template files. Exitting early."
|
||||
git reset --hard
|
||||
exit 0
|
||||
fi
|
||||
|
||||
info "Merging any new keys from templates/LC_MESSAGES/django.pot"
|
||||
for i in `find . -name "django.po" | grep -v "en_US"`; do
|
||||
|
|
Загрузка…
Ссылка в новой задаче