50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
name: Daily Upstream Sync
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 1 * * *"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Capture upstream commit
|
|
id: upstream
|
|
run: |
|
|
echo "commit=$(git ls-remote https://github.com/KHwang9883/MobileModels.git refs/heads/master | awk '{print $1}')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Sync upstream raw data
|
|
run: |
|
|
python3 tools/sync_upstream_mobilemodels.py --build-index --export-mysql-seed
|
|
|
|
- name: Commit changes
|
|
env:
|
|
UPSTREAM_COMMIT: ${{ steps.upstream.outputs.commit }}
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add brands misc README.md README_en.md CHANGELOG.md CHANGELOG_en.md LICENSE.txt dist/device_index.json dist/mobilemodels_mysql_seed.sql
|
|
if git diff --cached --quiet; then
|
|
echo "No upstream changes to commit."
|
|
exit 0
|
|
fi
|
|
git commit -m "chore: sync upstream raw data ${UPSTREAM_COMMIT::7}"
|
|
|
|
- name: Push changes
|
|
run: git push
|