Sync with MobileModels #667
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By zhyi828 @ 2021-11-14 | |
--- | |
name: Sync with MobileModels | |
on: | |
workflow_dispatch: # To allow manual runs | |
schedule: | |
- cron: '43 10 * * *' | |
jobs: | |
Task: | |
runs-on: ubuntu-latest | |
# if: github.event.repository.owner.id == github.event.sender.id # 自己点的 start | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Git Sumbodule Update | |
run: | | |
git pull --recurse-submodules | |
git submodule update --remote --recursive | |
- name: Set up Python #安装python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install requirements | |
run: | | |
pip install -r requirements.txt | |
- name: Update MobileModels | |
run: | | |
cd MobileModels | |
ls | |
git log | |
echo "LATEST_COMMIT=$(git log -1 --format="%H")" >> $GITHUB_ENV | |
cd .. | |
- name: Run | |
run: | | |
echo `date +"%Y-%m-%d %H:%M:%S"` begin | |
python phoneModel.py | |
git status | |
# git diff | |
- name: Commit # 提交更新, fork后请自行修改user信息 | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name zhyi828 | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Sync with MobileModels $LATEST_COMMIT" -a | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} # fork后自行配置GITHUB_TOKEN |