forked from quacktacular/mac-device-id-to-model
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.34 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Update models nightly
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
update_models:
name: Update models and create PR
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Run update_models.py
run: python update_models.py
- name: Check for changes
id: check_changes
run: |
git diff --exit-code || echo "There are changes."
echo ::set-output name=has_changes::$(if [ $? -eq 0 ]; then echo "false"; else echo "true"; fi)
- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Update models"
git push
- name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update models"
title: "Update models"
body: "This pull request updates the models nightly and creates a PR"