Skip to content

Update schedule

Update schedule #16

Workflow file for this run

name: 'Update schedule'
on:
schedule:
- cron: '0 22 * * *'
- cron: '0 10 * * *'
workflow_dispatch:
branches:
- master
- dev
- gd
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.13
uses: actions/setup-python@v4
with:
python-version: '3.13'
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.open_driver
except:
open_driver = False
print(open_driver)')" >> $GITHUB_ENV
# - name: Check open_ffmpeg config
# id: check_ffmpeg
# run: |
# echo "OPEN_FFMPEG=$(python -c '
# try:
# from utils.config import config
# open_ffmpeg = config.open_ffmpeg
# except:
# open_ffmpeg = False
# print(open_ffmpeg)')" >> $GITHUB_ENV
- name: Set up Chrome
if: env.OPEN_DRIVER == 'True'
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Download chrome driver
if: env.OPEN_DRIVER == 'True'
uses: nanasess/setup-chromedriver@master
# - name: Install FFmpeg
# if: env.OPEN_FFMPEG == 'True'
# 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.13 && pipenv install --deploy
- name: Install selenium
if: env.OPEN_DRIVER == 'True'
run: pipenv install selenium
- name: Update
run: pipenv run dev
- 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.final_file
except:
final_file = "output/result.txt"
print(final_file)')
final_m3u_file=$(python -c '
try:
from utils.config import config
import os
final_file = config.final_file
final_m3u_file = os.path.splitext(final_file)[0] + ".m3u"
except:
final_m3u_file = "output/result.m3u"
print(final_m3u_file)')
if [[ -f "$final_file" ]]; then
git add -f "$final_file"
fi
if [[ -f "$final_m3u_file" ]]; then
git add -f "$final_m3u_file"
fi
if [[ -f "output/cache.pkl" ]]; then
git add -f "output/cache.pkl"
fi
if [[ -f "output/sort.log" ]]; then
git add -f "output/sort.log"
fi
if [[ -f "updates/fofa/fofa_hotel_region_result.pkl" ]]; then
git add -f "updates/fofa/fofa_hotel_region_result.pkl"
fi
if [[ -f "updates/fofa/fofa_multicast_region_result.pkl" ]]; then
git add -f "updates/fofa/fofa_multicast_region_result.pkl"
fi
if ! git diff --staged --quiet; then
git commit -m "Github Action Auto Updated"
git push --force
fi