fix(CI): Fetch before commit.

This commit is contained in:
Terry Geng 2020-07-13 07:55:01 +08:00
parent 8ca59ed5c8
commit 46cb0387fc
No known key found for this signature in database
GPG Key ID: F982F8EA1DF720E7

View File

@ -137,12 +137,14 @@ steps:
from_secret: GITHUB_API from_secret: GITHUB_API
commands: commands:
- apt update && apt install -y git python3-requests hub - apt update && apt install -y git python3-requests hub
- git remote set-url origin https://azlux:$GITHUB_API@github.com/azlux/botamusique/
- | - |
if ! git checkout bot-traduora; then if git fetch origin bot-traduora; then
git branch bot-traduora && git checkout bot-traduora git branch bot-traduora FETCH_HEAD
need_pr=true else
git branch bot-traduora
fi fi
git pull - git checkout bot-traduora
- (cd lang/ && ./sync_translation.py --client $TRADUORA_R_CLIENT --secret $TRADUORA_R_SECRET --fetch) - (cd lang/ && ./sync_translation.py --client $TRADUORA_R_CLIENT --secret $TRADUORA_R_SECRET --fetch)
- git add lang/* - git add lang/*
- git status - git status
@ -151,10 +153,8 @@ steps:
git remote set-url origin https://azlux:$GITHUB_API@github.com/azlux/botamusique/ git remote set-url origin https://azlux:$GITHUB_API@github.com/azlux/botamusique/
git push origin bot-traduora git push origin bot-traduora
sleep 2 sleep 2
if [ ! -z $need_pr ]; then
GITHUB_USER="azlux" GITHUB_TOKEN="$GITHUB_API" hub pull-request -m "Bot: TRADUORA Update" GITHUB_USER="azlux" GITHUB_TOKEN="$GITHUB_API" hub pull-request -m "Bot: TRADUORA Update"
fi fi
fi
trigger: trigger:
event: event: