Skip to content

Update

Update #1408

Workflow file for this run

name: Update
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 20 * * *'
workflow_dispatch:
inputs:
dry-run:
type: boolean
description: Do not publish the result on Femiwiki and only print internally.
default: false
jobs:
Update:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
cache: pip
- uses: actions/cache@v3
with:
path: tmp/rc-cache
key: rc-cache
- run: python3 -m pip install -r requirements.txt
- run: python setup.py bdist_wheel
- run: python3 -m pip install dist/rankingbot-*.whl
- name: Update
run: python -m rankingbot
env:
RANKINGBOT_PASSWORD: ${{ secrets.RANKINGBOT_PASSWORD }}
BOT_TEST: ${{ github.event.inputs.dry-run }}
- name: Remove old rc caches
env:
# 보존할 바뀐글 캐시 일수. 30일까지 계산할 것이므로 30개만 있으면 되는데 혹시 모르니 여유를 둬서 35개 유지
TIME_WINDOW: 35
run: |
OLDS=$(ls -t tmp/rc-cache | tail -n +${{ env.TIME_WINDOW }})
echo 'Old files:'
echo $OLDS
IFS=$'\n\t'
for OLD in "$OLDS"; do
[ -f "tmp/rc-cache/$OLD" ] && rm "tmp/rc-cache/$OLD"
done
echo 'Cached files:'
ls tmp/rc-cache