mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
adding logic to handle if there are no changes
This commit is contained in:
46
.github/workflows/crowdin-sync.yml
vendored
46
.github/workflows/crowdin-sync.yml
vendored
@@ -130,27 +130,49 @@ jobs:
|
|||||||
unzip -o $SAVE_FILE
|
unzip -o $SAVE_FILE
|
||||||
rm $SAVE_FILE
|
rm $SAVE_FILE
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Check changes
|
||||||
|
id: files-changed
|
||||||
env:
|
env:
|
||||||
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
|
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
|
||||||
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
|
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
|
||||||
run: |
|
run: |
|
||||||
echo "[*] Adding new translations"
|
DIFF_BRANCH=master
|
||||||
git add .
|
if [[ "$BRANCH_EXISTS" == "true" ]]; then
|
||||||
echo "=====Translations Changed====="
|
DIFF_BRANCH=$BRANCH_NAME
|
||||||
git status
|
fi
|
||||||
echo "=============================="
|
|
||||||
echo "[*] Committing"
|
|
||||||
git commit -m "Autosync Crowdin translations"
|
|
||||||
|
|
||||||
echo "[*] Pushing"
|
DIFF_LEN=$(git diff origin/${DIFF_BRANCH} | wc -l | xargs)
|
||||||
if [ "$BRANCH_EXISTS" == "false" ]; then
|
echo "[*] git diff lines: ${DIFF_LEN}"
|
||||||
git push -u origin $BRANCH_NAME
|
echo "::set-output name=num::$DIFF_LEN"
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
|
||||||
|
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
|
||||||
|
DIFF_BRANCH: master
|
||||||
|
DIFF_LEN: ${{ steps.files-changed.outputs.num }}
|
||||||
|
run: |
|
||||||
|
echo "=====Translations Changed====="
|
||||||
|
git diff --name-only origin/${DIFF_BRANCH}
|
||||||
|
echo "=============================="
|
||||||
|
|
||||||
|
if [ "$DIFF_LEN" != "0" ]; then
|
||||||
|
echo "[*] Adding new translations"
|
||||||
|
git add .
|
||||||
|
echo "[*] Committing"
|
||||||
|
git commit -m "Autosync Crowdin translations"
|
||||||
|
echo "[*] Pushing"
|
||||||
|
if [ "$BRANCH_EXISTS" == "false" ]; then
|
||||||
|
git push -u origin $BRANCH_NAME
|
||||||
|
else
|
||||||
|
git push
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
git push
|
echo "[*] No new docs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Create/Update PR
|
- name: Create/Update PR
|
||||||
|
if: ${{ steps.files-changed.outputs.num }} != 0
|
||||||
env:
|
env:
|
||||||
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
|
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
|
||||||
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
|
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
|
||||||
|
|||||||
Reference in New Issue
Block a user