Skip to content

Update Bing image #1411

Update Bing image

Update Bing image #1411

Workflow file for this run

name: Update Bing image
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- 'script/crawler.py'
- '.github/workflows/update.yml'
schedule:
# 15:00 every day Asia/Shanghai
- cron: "0 7 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
cd script
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Echo the event name
run: |
echo ${{ github.event }}
echo ${{ github.event_name }}
- name: Update image with wait
if: github.event_name == 'schedule'
run: |
export TZ=Asia/Shanghai
cd script
python crawler.py --wait
env:
BOTTOKEN: ${{ secrets.BOTTOKEN }}
CHANNELIDMAIN: ${{ secrets.CHANNELIDMAIN }}
CHANNELIDARCHIVE: ${{ secrets.CHANNELIDARCHIVE }}
- name: Update image without wait
if: github.event_name != 'schedule'
run: |
export TZ=Asia/Shanghai
cd script
python crawler.py
env:
BOTTOKEN: ${{ secrets.BOTTOKEN }}
CHANNELIDMAIN: ${{ secrets.CHANNELIDMAIN }}
CHANNELIDARCHIVE: ${{ secrets.CHANNELIDARCHIVE }}
- name: Move files to archive
run: |
pwd
mkdir archive
mv data archive
mv img archive
- name: Push archives
uses: JamesIves/[email protected]
with:
GIT_CONFIG_NAME: Bing Image Bot
GIT_CONFIG_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: archive # The branch the action should deploy to.
FOLDER: archive # The folder the action should deploy.
CLEAN: false # Don't automatically remove deleted files from the deploy branch.
COMMIT_MESSAGE: Update Bing images.