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