63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
name: Update ASMR data
|
|
|
|
on:
|
|
schedule:
|
|
# 00:30 JST. Scheduled actions may run a little later depending on runner load.
|
|
- cron: "30 15 * * *"
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Update ASMR JSONL data
|
|
run: |
|
|
if [ "${GITHUB_EVENT_NAME:-}" = "push" ]; then
|
|
last_commit_message="$(git log -1 --pretty=%B)"
|
|
case "$last_commit_message" in
|
|
*"[skip ci]"*)
|
|
echo "Skipping data update for CI-generated commit."
|
|
touch .skip-asmr-data-update
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
python scripts/update_daily_asmr_data.py --skip-web-data --force
|
|
else
|
|
python scripts/update_daily_asmr_data.py --skip-web-data
|
|
fi
|
|
|
|
- name: Commit and push changes
|
|
run: |
|
|
if [ -f .skip-asmr-data-update ]; then
|
|
echo "Data update skipped."
|
|
exit 0
|
|
fi
|
|
|
|
if git diff --quiet -- asmr_works.jsonl asmr_works.filtered.jsonl; then
|
|
echo "No ASMR data changes to commit."
|
|
exit 0
|
|
fi
|
|
|
|
git config user.name "gitea-actions[bot]"
|
|
git config user.email "gitea-actions[bot]@users.noreply.local"
|
|
git add asmr_works.jsonl asmr_works.filtered.jsonl
|
|
git commit -m "daily data update [skip ci]"
|
|
git pull --rebase --autostash origin main
|
|
git push origin HEAD:main
|