Skip to content

update schedule

update schedule #440

Workflow file for this run

name: 'update schedule'
on:
schedule:
- cron: '0 22 * * *'
- cron: '0 10 * * *'
workflow_dispatch:
branches:
- master
- dev
- gd
- gd-test
jobs:
push:
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 120
strategy:
matrix:
operating-system: ['ubuntu-20.04']
steps:
- name: Set branch name
id: vars
run: echo "BRANCH_NAME=${{ github.repository_owner == 'Guovin' && 'gd' || 'master' }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH_NAME }}
- name: Run with setup-python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
update-environment: true
cache: 'pipenv'
- name: Check open_driver config
id: check_driver
run: |
echo "OPEN_DRIVER=$(python -c '
try:
from utils.config import config
open_driver = config.getboolean("Settings", "open_driver")
except:
open_driver = False
print(open_driver)')" >> $GITHUB_ENV
- name: Install Selenium
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true'
run: |
sudo pip3 install selenium
- name: Set up Chrome
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true'
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Download chrome driver
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true'
uses: nanasess/setup-chromedriver@master
- name: Launch chrome driver
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true'
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Install FFmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install pipenv
run: pip3 install --user pipenv
- name: Install dependecies
run: pipenv --python 3.8 && pipenv install
- name: Build
run: pipenv run build
- name: Commit and push if changed
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff
final_file=$(python -c '
try:
from utils.config import config
final_file = config.get("Settings", "final_file")
except:
final_file = "output/result.txt"
print(final_file)')
if [[ -f "$final_file" ]]; then
git add -f "$final_file"
fi
if [[ -f "result.txt" ]]; then
git add -f "result.txt"
fi
if [[ -f "output/user_result.log" ]]; then
git add -f "output/user_result.log"
elif [[ -f "output/result.log" ]]; then
git add -f "output/result.log"
fi
if ! git diff --staged --quiet; then
git commit -m "Github Action Auto Updated"
git push --force
fi